Site logo

[Resolved] Disable Sidebar in Search Results on WordPress w/Woocommerce

Home Forums Support [Resolved] Disable Sidebar in Search Results on WordPress w/Woocommerce

Home Forums Support Disable Sidebar in Search Results on WordPress w/Woocommerce

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1729553
    Jeff

    GeneratePress Theme: 3.03
    GP Premium: 1.12.3
    WordPress: 5.7

    Hi, I’m trying to disable the Sidebar on my Search Results page for my store. I’ve tried the following code found in other threads here in the forums by adding it to the “Code Snippets” plugin but it doesn’t seem to be working and the sidebar still shows up.

    Code Snippets:

    add_filter('generate_blog_masonry','generate_blog_woocommerce_masonry');
    function generate_blog_woocommerce_masonry()
    {
    	// Disable in WooCommerce
    	if ( is_woocommerce() )
    		return 'false';
    
    	// Check if blog
    	if ( is_home() )
    		return 'true';
    	
            // Otherwise, disable it
    	return 'false';
    }

    Any help would be greatly appreciated!

    Thanks,
    Jeff

    #1729649
    Jeff

    OK, I figured out how to turn off the sidebar for Blog pages and the Search Results page seems to follow that. However, when turning it off, the Search Box showing what the person searched on goes away too.

    I’m thinking the real question is how do I turn off “Recent Posts, Recent Comments, Archives, Categores and Meta sections of the sidebar on the Search Results page? Thanks.

    #1729668
    Jeff

    Turned off “Recent Posts”, “Recent Comments”, “Archives”, “Categories” and “Meta” sections of the sidebar in the widgets settings and now just have the Search box in the sidebar area which is what I wanted. Think I’m good now.

    #1729673
    David
    Staff
    Customer Support

    Glad to hear you found a solution!

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