askdesign
2/4/2017 - 11:02 PM

Creating a New Widget Area in the Fun Theme

February 3, 2017 by Susan Ramsey

/* --- Finally, open up your stylesheet, and in the section under --- */
/* Home Page Widget, add in the following: ---*/

.home-new {
border-top: 1px solid #000;
margin: 0 auto 20px;
padding-bottom: 7px;
max-width: 1140px;
}

/* --- Then, look for: --- */

.home-products .widget {
margin-top: 30px;
}

.home-products .widgettitle {
margin-bottom: 4px;
}

/* --- Replace that section with: ---*/

.home-products .widget,
.home-new .widget {
margin-top: 30px;
}

.home-products .widgettitle,
.home-new .widgettitle {
margin-bottom: 4px;
}

// Once you have added that to your functions.php file, we need to “hook” the widget. (Hooking the widget means defining which Genesis Hook the widget is to be associated with). So, open up your front-page.php file, and add this:

add_action( 'genesis_after_header', 'fun_home_new' );
function fun_home_new() {
	if ( is_home() || is_front_page() ) {
		genesis_widget_area( 'home-new', array(
			'before'	=> '<div class="home-new widget-area"><div class="wrap">',
			'after'		=> '</div></div>',
		) );
	}
}
// Register the new widget
// The location of this is very important, because this is what will determine the location of the widget on your front page. We want the new widget to display below the Home Blog Posts Featured widget, so add that code immediately below it, so that it looks like this:

genesis_register_sidebar( array(
	'id'				=> 'home-new',
	'name'			=> 'New Home Widget Area',
	'description'	=> 'This is the new section on your home page below the Home Blog Featured widget'
) );