Reply To: Hide sidebar in woocommerce search results page

Home Forums Support Hide sidebar in woocommerce search results page Reply To: Hide sidebar in woocommerce search results page

#165350
Tom
Lead Developer
Lead Developer

Hi there,

Give this function a try:

add_filter( 'generate_sidebar_layout','generate_custom_woocommerce_sidebar_layout' );
function generate_custom_woocommerce_sidebar_layout( $layout )
{
 	// If we are on a woocommerce page, set the sidebar
 	if ( is_woocommerce() )
 	 	return 'no-sidebar';

 	// Or else, set the regular layout
 	return $layout;

 }

Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

I’ll be adding this as an option in the Customizer soon 🙂