Site logo

Archived topic

Right-sidebar and woocommerce subcategoryes

3 replies · Started by Anonymous on January 15, 2016

Viewing posts 1–4 of 4

How can I hide the right-sidebar with filters on the page where I show subcategoryes in woocommerce?
On the page where I show categoryes, the right-sidebar with filters is hiding.

This code I put in the function.php

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 'both-sidebars';

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

 }

I think you can use the product_category() conditional: https://docs.woothemes.com/document/conditional-tags/

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 'both-sidebars';

 	if ( is_product_category( 'shirts' ) )
 	 	return 'no-sidebar';

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

 }

Thank you very much!!! When I first put "is_product_category" and after I put "is_woocommerce" it worked.

Great, you're welcome :)

This archived topic is closed to new replies.