How to set the Sidebar?
-
I’ve just installed Woocommerce into my website and it’s working great apart from one thing…
Sidebars!
How do I set which Sidebar the Shop page and other WooCommerce pages use?
As part of my theme I can create an unlimited number of sidebars, which I then assign by going to the relevant page, but on WooCommerce pages this doesn’t work…. it just displays the Default sidebar.
How can I change this?
(I am building a website that is for the most part a blog, with a shop tagged on the end, so I definitely need different sidebars for Blog pages compared to Shop/Product pages)
-
Any help with this would be massively appreciated.
It seems like it is always picking up the default / archive sidebar rather than picking up a one that I specify. I’ve even tried copying my theme’s page.php file and calling it woocommerce.php and swapping out the loop for <?php woocommerce_content(); ?> but that still results in the same sidebar appearing no matter what.
Surely there must be a way to hardcode which sidebar I want to display?
The WooCommerce shop page is not a page, it is a post type archive. That probably explains why you cannot set a custom sidebar.
If your theme allows you to set a custom sidebar for post types then that is how you should do it. Seems like a strange piece of functionality to include in a theme though.
Alternatively you could create a sidebar-shop.php file, or look at our WooSidebars plugin.
Thanks. The WooSidebars plugin seems to have worked.
@jameskoster with that said, you should be able to override the template being used for the shop page with a custom template. I tried archive-product.php but doesn’t work. Do you know what the name of the template should be?
archive-product.php should do it.
Is there any detailed documentation on that? All I read is “use this file or this file” but I dont get whyt to change there. I have set up a woocommerce.php. Now whats the next step?
- The topic ‘How to set the Sidebar?’ is closed to new replies.