You can set all of WooCommerce pages including all product pages to be full width content inside of a Genesis Theme by adding a function and filter to your functions.php file.
So in the above the WooCommerce shop, cart and checkout pages are targeted in an array plus the custom post type ‘Products’ which is the page type all the products are used for output.
Similarly if you wanted to add a sidebar to all the WooCommerce pages you would use:
Or alternatively use the other layout options in the return
- content-sidebar-sidebar
- sidebar-sidebar-content
- sidebar-content-sidebar
Also make sure you are using the Genesis Connect for WooCommerce Plugin.
Here is some further info on selecting the various WooCommerce pages with PHP conditional statements.
8 comments
Keri
Worked for me! Thanks!
pic-1
I wаs ablρe to find good info from your bllog posts.
Fermin June Seva Alegro III
This actually works nicely. Thanks for this. I modified the code to check if the pages are not Woocommerce and set them on a different layout:
add_filter( ‘genesis_site_layout’, ‘themeprefix_cpt_layout’ );
function themeprefix_cpt_layout() {
if( is_page ( array( ‘cart’, ‘checkout’ )) || is_shop() || ‘product’ == get_post_type() ) {
return ‘sidebar-content’;
} else {
return ‘full-width-content’;
}
}
This was done on Genesis 2.6.1 and Woocommerce 3.3.5
David
I found the problem in Woocommerce.
You have to add this line:
remove_action(‘woocommerce_sidebar’, ‘woocommerce_get_sidebar’);
David
If it does not work, what could it be the problem?
Gary Cheeseman
Awesome. I’ve look for a fix to remove the sidebar from all woocommerce pages and this works a treat.
Karla Archer
Perfect — thank you! This is the code I needed!
Nick
Thanks again guys!