[Resolved] Woocommerce sidebar shop page

Home Forums Support [Resolved] Woocommerce sidebar shop page

Home Forums Support Woocommerce sidebar shop page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #407694
    Robert

    I’d like to add a custom sidebar to just the Woocommerce shop page. I created a new sidebar and tried to get it to show up on the woocommerce default shop page but alas, nothing. Any ideas? The sidebar is showing up under Widgets.

    
     
     add_action( 'widgets_init', 'theme_slug_widgets_init' );
    function theme_slug_widgets_init() {
        register_sidebar( array(
            'name' => __( 'woo', 'woo' ),
            'id' => 'woo',
            'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'woo' ),
            'before_widget' => '<li id="%1$s" class="widget %2$s">',
    	'after_widget'  => '</li>',
    	'before_title'  => '<h2 class="widgettitle">',
    	'after_title'   => '</h2>',
        ) );
    }
    
     
     add_action( 'wp','tu_woocommerce_sidebar' );
    
    function tu_woocommerce_sidebar()
    {
        if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
            remove_action( 'generate_sidebars','generate_construct_sidebars' );
            add_action( 'generate_sidebars','tu_construct_woocommerce_sidebar' );
        }
    }
    
    function tu_construct_woocommerce_sidebar() {
        get_sidebar( 'woo' );
    }
    
    
    #407707
    Leo
    Staff
    Customer Support

    Hi there,

    So I assume you are using sidebar already on other pages as well?

    This plugin might be the easiest: https://en-ca.wordpress.org/plugins/content-aware-sidebars/

    #407732
    Robert

    Nope, I haven’t used this sidebar on any pages, I created it specifically for this one page.

    #407758
    Leo
    Staff
    Customer Support

    Ahh if that’s the case, set the global setting to Content (No Sidebar): https://docs.generatepress.com/article/sidebar-layout/

    Then turn it on for WooCommerce only: https://docs.generatepress.com/article/woocommerce-overview/#shop

    Let me know.

    #408028
    Robert

    Sorry, maybe I wasn’t clear. I am using sidebars throughout the site, but I would like to create a brand new one, specifically used for just the Woocommerce pages, and not use an existing one. I registered the new sidebar, the issue is having it show up only on the Woocommerce pages, as the default sidebar is currently showing.

    #408051
    Leo
    Staff
    Customer Support
    #408634
    Robert

    I haven’t. I was trying to avoid having to use a plugin and managing multiple widgets. I find it cleaner to do it by just creating a new sidebar and assigning it to a page but I guess that isn’t possible with this theme. Thanks.

    #408648
    Leo
    Staff
    Customer Support

    No problem!

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