[Resolved] Different sidebar layout for different blog post pages

Home Forums Support Different sidebar layout for different blog post pages

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #142083
    Sharon Steely

    I use the latest posts as my home page. I used the customizer to set the layout for Blog Sidebar Layout to Content (no sidebars) which is what I want for the home page.

    For my archives and categories, I want the left sidebar to show. Since these aren’t technically “pages” I don’t see a way to edit to turn off global settings.

    Here is my home page currently:

    Here is a category page, which I want to display with the left sidebar:

    This is a dev site.

    Thanks for your help!


    Hi Sharon. You could set the default layout to left sidebar, then use this function in your child theme functions.php file to remove the sidebar on your home page:

    add_filter( 'generate_sidebar_layout','generate_custom_sidebar_layout' );
    function generate_custom_sidebar_layout( $layout ) {
        // If we are on the home page, no sidebar
        if ( is_home() )
            return 'no-sidebar';
        // Or else, set the regular layout
        return $layout;

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    Sharon Steely

    Thanks bdbrown! I just implemented your suggestion and it worked!

    I appreciate you sharing the code as-is. My knowledge of pHP is very limited.

    Thanks for your help!

    And thanks for writing an awesome theme Tom!


    Glad to help 🙂 If you’re interested in learning more about PHP, here are a couple of good tutorials to get you started:


    Sharon Steely

    cool, thanks.

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