[Resolved] Right-sidebar and woocommerce subcategoryes

Home Forums Support [Resolved] Right-sidebar and woocommerce subcategoryes

Home Forums Support Right-sidebar and woocommerce subcategoryes

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #165946
    organ2

    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;
    
     }
    #165958
    Tom
    Lead Developer
    Lead Developer

    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;
    
     }
    #165970
    organ2

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

    #165983
    Tom
    Lead Developer
    Lead Developer

    Great, you’re welcome 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.