This is a continuation of a closed post found here:
The solution described in the previous post (Part II) worked well to force a left sidebar on shop product category pages when the theme’s default sidebar is right.
The solution worked by detecting that the user is on a product category page using is_product_category() and then forcing the left sidebar accordingly.
Unfortunately, this solution is not working on the shop product search results page because the system is correctly detecting that the user is NOT on a product category page and so the default right sidebar is shown.
My question is: how can I detect that the user is on the shop product search results page so that I can force a left sidebar for this page as well? Is there a function like is_product_search() that I can also test for?
All woocommerce specific conditional tags are listed here: http://wcdocs.woothemes.com/codex/theming/conditional-tags/ – eg you can try is_woocommerce() && is_search()
The combination of is_woocommerce() and is_search() did not work. However, removing is_search() and only checking for is_woocommerce() did force the correct class to be added to the Div (e.g. sidebar_left). Unfortunately, despite that we are now including the correct class, the sidebar is still appearing on the right. Can’t understand why.
Perhaps you could take a look here:
The correct placement left-side placement of the sidebar can be seen on another page here:
I can’t see any obvious difference in the code.
Try to add following code to css/custom.css:
The topic ‘Override Sidebar Position For Shop Pages (Part III)’ is closed to new replies.