is_primary_sidebar_active()` * * `bongo()->display_primary_sidebar()` * * @link https://developer.wordpress.org/themes/functionality/sidebars/ */ class Component implements Component_Interface, Templating_Component_Interface { const PRIMARY_SIDEBAR_SLUG = 'sidebar-1'; /** * Gets the unique identifier for the theme component. * * @return string Component slug. */ public function get_slug() : string { return 'sidebars'; } /** * Adds the action and filter hooks to integrate with WordPress. */ public function initialize() { add_action( 'widgets_init', array( $this, 'action_register_sidebars' ) ); add_filter( 'body_class', array( $this, 'filter_body_classes' ) ); } /** * Gets template tags to expose as methods on the Template_Tags class instance, accessible through `bongo()`. * * @return array Associative array of $method_name => $callback_info pairs. Each $callback_info must either be * a callable or an array with key 'callable'. This approach is used to reserve the possibility of * adding support for further arguments in the future. */ public function template_tags() : array { return array( 'is_primary_sidebar_active' => array( $this, 'is_primary_sidebar_active' ), 'display_primary_sidebar' => array( $this, 'display_primary_sidebar' ), ); } /** * Registers the sidebars. */ public function action_register_sidebars() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'bongo' ), 'id' => static::PRIMARY_SIDEBAR_SLUG, 'description' => esc_html__( 'Add widgets here.', 'bongo' ), 'before_widget' => '', 'before_title' => '