renderer = $renderer; } /** * Register hooks. * * @return void */ public function register() { add_action( 'init', array( $this, 'add_shortcodes' ) ); } /** * Register the shortcodes. * * @return void */ public function add_shortcodes() { add_shortcode( 'quick_faq', array( $this, 'render' ) ); add_shortcode( 'accordion_faq', array( $this, 'render' ) ); } /** * Shortcode callback. * * @param array|string $atts Shortcode attributes. * @return string */ public function render( $atts ) { $atts = shortcode_atts( array( 'id' => 0, // Backward compatibility: taxonomy term ID. 'term' => 0, 'category' => '', 'ids' => '', 'style' => '', 'mode' => '', 'engine' => '', 'heading' => '', 'icon' => '', 'open_first' => '', 'orderby' => '', 'order' => '', 'limit' => '', 'search' => '', 'filter' => '', 'expand_all' => '', 'toc' => '', 'schema' => '', 'per_page' => '', 'class' => '', ), is_array( $atts ) ? array_change_key_case( $atts, CASE_LOWER ) : array(), 'quick_faq' ); // Remove empty overrides so renderer defaults (from settings) apply. $atts = array_filter( $atts, static function ( $value ) { return '' !== $value && null !== $value; } ); return $this->renderer->render( $atts ); } }