Archived topic
Any way to disable elements and sidebar for all WooCommerce product pages?
7 replies · Started by Shaun on May 20, 2018
Hi guys, I've got approximately 100 WooCommerce products that I'll be importing soon. Is there any way I can mass disable the sidebar and certain elements (e.g. page header) from the individual product pages? Thanks in advance.
Hi there,
Are you wanting sidebar on the main products page? If not then you can just use this setting here:
https://docs.generatepress.com/article/woocommerce-overview/#shop
There shouldn't be page header showing by default unless it was assigned to them in page header global location:
https://docs.generatepress.com/article/page-header-global-locations/
Let me know if this helps.
Thanks Leo! I managed to get rid of the sidebar for the products' pages.
I also want to specifically disable the Top Bar for these pages. Is there a way to do it en masse?
Try this snippet:
add_action( 'wp', 'lh_disable_woo_topbar' );
function lh_disable_woo_topbar() {
if ( is_woocommerce() ) {
remove_action( 'generate_before_header','generate_top_bar', 5 );
}
}
Thanks Leo. Do I just copy and paste this into Simple CSS?
That code can be added using one of these methods: https://docs.generatepress.com/article/adding-php/
Awesome! Thanks Tom and Leo. The code works like a charm!
You're welcome :)