Archived topic
Disable Sidebar in Search Results on WordPress w/Woocommerce
3 replies · Started by Jeff on April 11, 2021
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
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.
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.
Glad to hear you found a solution!