• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to assign a different sidebar to the homepage?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to assign a different sidebar to the homepage?

This topic is: resolved

Tagged: homepage, post page, Sidebar

  • This topic has 3 replies, 2 voices, and was last updated 13 years, 2 months ago by glasertech.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • January 2, 2013 at 9:13 am #8938
    glasertech
    Member

    Hello,

    We need a special sidebar for the homepage. We tried to use the "Genesis - Simple Sidebars" plugin, but we cannot assign the new sidebar to the hompage.

    Another solution could be to assign a different sidebar as the primary sidebar to ALL post pages.

    Is there a solution with not too much coding effort and keeping the automatical upgrade capability?

    Thank You in advance,
    Max Glaser

    January 2, 2013 at 9:34 am #8942
    Chris Cree
    Participant

    Which theme are you using, Max? Also it would help to share a link to your site when asking for help here.

    In the meantime, I think this should work in most cases. Add this to your functions.php file.

    add_action( 'get_header', 'child_home_sidebar_switch' );
    function child_home_sidebar_switch() {
    	if( is_front_page() ) {
    		remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
    		genesis_widget_area( 'home-sidebar');
    	}
    }

    You will also need to add the new home-sidebar to your functions.php file too. Here's the code to do this.

    genesis_register_sidebar( array(
    	'id'			=> 'home-sidebar',
    	'name'			=> __( 'Home Sidebar', 'genesis' ),
    	'description'	=> __( 'This is the Homepage Sidebar.', 'genesis' ),
    ) );
    January 2, 2013 at 9:57 am #8946
    glasertech
    Member

    Chris,

    Thank you for your answer. We are using the news theme. I already added your code on the functions.php file in the news themes directory, an I can see the "Home Sidebar", but how can I assign it to the homepage?

    January 2, 2013 at 1:34 pm #9008
    glasertech
    Member

    Chris,

    Thank You! Finally I understood the Genesis Hook and Sidebar APIs 🙂

    My solution is to add into the file functions.php in the child's theme directory the following code:


    add_action( 'get_header', 'child_home_sidebar_switch' );
    function child_home_sidebar_switch() {
    if( is_front_page() ) {
    remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
    add_action( 'genesis_after_content', 'child_get_home_sidebar' );
    }
    }

    function child_get_home_sidebar() {
    echo '';
    get_sidebar( 'home' );
    echo '';
    }

    and to create the following new file sidebar-home.php also in the child's theme directory

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble