I made custom sidebar and put YITH WooCommerce Ajax Product Filter widget inside to show filter by color. I did the following steps:
-
In my functions.php I registered sidebar like this:
add_action( 'widgets_init', 'my_register_sidebars' ); function my_register_sidebars() { /* Register the 'primary' sidebar. */ register_sidebar( array( 'id' => 'primary', 'name' => __( 'Primary Sidebar' ), 'description' => __( 'A short description of the sidebar.' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); }
-
I made sidebar-primary.php like this:
<div id="sidebar-primary" class="sidebar"> <?php dynamic_sidebar( 'primary'); ?></div>
-
Added widget to my sidebar
-
On my page where I need the content of sidebar to show, I included sidebar-primary.php like this:
<?php include('sidebar-primary.php'); ?>
But nothing is showing. Any suggestions? Maybe I am doing something wrong without even realizing it. Thanx.