How to add new widget section on homepage in Genesis

You may want to add a new widget section on homepage of your Genesis powered WordPress website. New widget area can be used for any type of widget content like for showing featured posts, responsive slider, introduction tagline text and so on.

Create new widget area on homepage in Genesis

1. Add following code in functions.php file found at Appearance > Editor in WordPress dashboard. It adds new widget with name “homepage-feature” on the homepage.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/** Add new widget under header on homepage in Genesis theme | basicwp.com/add-new-widget-genesis-homepage/ */
genesis_register_sidebar( array(
    'id'                => 'homepage-feature',
    'name'          => __( 'Homepage Feature', 'custom' ),
    'description'   => __( 'This is Homepage feature section', 'custom' ),
) );
 
/** Top Homepage feature section */
add_action( 'genesis_after_header', 'news_homepage_feature', 9 );
function news_homepage_feature() {
    if ( is_home() && is_active_sidebar( 'homepage-feature' ) ) {
    echo '<div class="homepage-feature">';
    dynamic_sidebar( 'homepage-feature' );
    echo '</div><!-- end .homepage-feature -->';
    }
}

2. Once you add above code, goto Widgets area and you should see new “homepage-feature” section. You can drag any widget to display content in new the widget area on your Genesis website. You can also customize following in the above code:

- CCS styling of content added to this widget area can done using “homepage-feature” class. To get started, you can add following code to style.css file and modify it further as per requirement.

1
2
3
4
5
.homepage-feature {
background:#ddd;
width:960px;
margin:0 auto;
}

- The place where widget is displayed, above code adds new widget below the “header”. You can replace “genesis_after_header” in above code with appropriate position or location hook.

- If you want widget to appear on everypage, remove “is_home()” in the above code. By default, above code will show widget only on the homepage.

SHARE

Comments

  1. Thanks for posting this tutorial. I added the code but the featured area is actually showing up on my blog page instead of my homepage. I changed the settings in WordPress in the Reading section to use a static home page, so I would like to know how to add custom widget areas to the home page not blog.

    Thanks!

  2. when i insert this into my child theme function.php i get the dreaded blank page error. any advice?
    this is word press 3.5.1

  3. This is why I love Genesis: everything is modular and with few lines of code you can add widgets and stuff.

  4. This worked perfectly and easily! Thank you!

Speak Your Mind

*

Subscribe to our mailing list

* indicates required
Close