-
-
Save About2git/e25e4ff412424aa97f20 to your computer and use it in GitHub Desktop.
Displaying custom widget area in Primary Sidebar in Genesis
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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