Skip to content

Instantly share code, notes, and snippets.

@braddalton
Last active December 15, 2015 00:49
Show Gist options
  • Select an option

  • Save braddalton/5176069 to your computer and use it in GitHub Desktop.

Select an option

Save braddalton/5176069 to your computer and use it in GitHub Desktop.
Adds a widget area before the content sidebar wrap on home page only in Genesis.
// Register widget
genesis_register_sidebar( array(
'id' => 'before-content',
'name' => __( 'Custom Widget', 'child' ),
'description' => __( 'This is the before content section.', 'child' ),
) );
// Hook widget to home page only using before content sidebar wrap hook
add_action( 'genesis_before_content_sidebar_wrap', 'custom_before_content', 9 );
function custom_before_content() {
if ( is_home() && is_active_sidebar( 'before-content' ) ) {
echo '<div class="before-content"><div class="wrap">';
dynamic_sidebar( 'before-content' );
echo '</div></div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment