Skip to content

Instantly share code, notes, and snippets.

@About2git
Forked from srikat/functions.php
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save About2git/e25e4ff412424aa97f20 to your computer and use it in GitHub Desktop.

Select an option

Save About2git/e25e4ff412424aa97f20 to your computer and use it in GitHub Desktop.
Displaying custom widget area in Primary Sidebar in Genesis
genesis_register_sidebar( array(
'id' => 'home-sidebar',
'name' => __( 'Home Sidebar', 'your-theme-slug' ),
'description' => __( 'This is the home sidebar section.', 'your-theme-slug' ),
) );
add_action( 'genesis_after_header', 'sk_custom_sidebar_homepage' );
function sk_custom_sidebar_homepage() {
if ( ! is_home() )
return;
// Remove the Primary Sidebar from the Primary Sidebar area.
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
// Place custom Sidebar into the Primary Sidebar area.
add_action( 'genesis_sidebar', 'sk_genesis_do_sidebar' );
}
function sk_genesis_do_sidebar() {
dynamic_sidebar( 'home-sidebar' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment