Customized sidebar for shop page
-
Hello!
I am currently working on a store using the Boutique child theme for Storefront. However, I’m stuck trying to add a sidebar for the shop page and was hoping someone could point me in the right direction!
The problem is that the Sidebar widget shows the same sidebar in the shop and the blog page and I want them to have different sidebars… I managed to create a new widget area for the shop by adding the following code to my custom functions.php (I am using a plugin to add custom css and functions because editing this child theme was not recommended).
function arphabet_widgets_init() { register_sidebar( array( 'name' => 'Shop sidebar', 'id' => 'sidebar-shop', 'before_widget' => '<div>', 'after_widget' => '</div>', 'before_title' => '<h2 class="rounded">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'arphabet_widgets_init' ); ?>
I have also added a sidebar-shop.php file with basically the same code as the normal sidebar.php file.
<?php /** * The sidebar for shop. * */ if ( ! is_active_sidebar( 'sidebar-shop' ) ) { return; } ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-shop' ); ?> </div><!-- #secondary -->
From this point I’m stuck. I tried to find an archive-products.php file to change the get_sidebar somehow. I know i need to find the page that controls the shop and then add some code in order to make it retrieve the correct widget but the naming conventions in Boutique and Storefront is really confusing me..
Does anyone know how to make the widget appear in the shop? I was hoping someone here might know how to fix this…
Best regards,
Daniel
- The topic ‘Customized sidebar for shop page’ is closed to new replies.