• Hi there,

    I’m trying to customize the PHP snippet from the documentation to display a custom sidebar, but on my woocommerce category pages and not on a custom post type.

    I have not been able to make it work, I’ve tried replacing if ( is_singular( 'gallery' ) ) with has_term or is_taxonomy but nothing, not sure if I’m doing it right.

    I’d appreaciate any help. Thanks in advance!

Viewing 1 replies (of 1 total)
  • Hello,

    To display the custom sidebar on woocommerce category page, you have to add the below code to the child theme’s functions.php file –

    function display_new_woo_sidebar( $sidebar ) {
    
         if ( is_product_category( 'gallery' ) ) {
     
            if ( is_active_sidebar( 'your-sidebar-id' ) && is_woocommerce() ) {
                $sidebar = 'your-sidebar-id';
            }
            return $sidebar;
         }
    }
    add_filter( 'ocean_get_sidebar', 'display_new_woo_sidebar' );
Viewing 1 replies (of 1 total)

The topic ‘Custom sidebar on woocommerce categories’ is closed to new replies.