[Resolved] Search sidebar

Home Forums Support [Resolved] Search sidebar

Home Forums Support Search sidebar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #418154
    Robert

    Hello,

    I’m having an issue with a sidebar that shows up when a search is performed that contains an archive widget and a search widget, as seen here: https://cl.ly/0J0u2g1N3M0O.

    The issue is that I don’t have any default sidebar that has the archives widget in it so wondering where this is coming from and how I can get rid of it. Thanks.

    #418192
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You can use this filter to remove the sidebars on the search page: https://docs.generatepress.com/article/generate_sidebar_layout/

    For example:

    add_filter( 'generate_sidebar_layout', 'tu_no_sidebar_search' );
    function tu_no_sidebar_search( $sidebar ) {
        if ( is_search() ) {
            return 'no-sidebar';
        }
    
        return $sidebar;
    }

    By default, the search results will use the sidebar layout you have set in Customize > Layout > Sidebars > Blog Sidebar

    #418748
    Robert

    Thanks Tom!

    #419062
    Tom
    Lead Developer
    Lead Developer

    You’re welcome 🙂

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