Answer the question
In order to leave comments, you need to log in
How to implement position switching of content and wordpress sidebar?
Good day!
There is an online store on WP + Woocommerce .
The task is this: on the main page, the sidebar should be on the right and the content on the left. When you open the product, they should change places.
I understand how to swap them, but I can't figure out in which template to set the reverse flow for a single product.
Thank you in advance.
Answer the question
In order to leave comments, you need to log in
Everything is much easier. The product has its own template, you can move the sidebar in it, change the HTML ... and the changes will affect only this page.
See the Woocommerce template structure.
You can search for the product template in your_theme/woocommerce/single-product.php folder, if there is no woocommerce folder in the theme, then create it and just copy the contents of templates from the Woocommerce plugin
In the woocommerce.php template
IF is_product() OR is_product_category() :
- connect get_sidebar() in the right column
and vice versa:
Or, if the theme has separate templates for single-product and archive-product, change the location of do_action( 'woocommerce_sidebar' ) as described above...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question