mirror of
https://github.com/10h30/genesis-simple-sidebars.git
synced 2026-07-18 05:53:26 +09:00
Add header widget area support. fixes #7.
This commit is contained in:
@@ -65,6 +65,15 @@ class Genesis_Simple_Sidebars_Core {
|
||||
*/
|
||||
public function swap_sidebars() {
|
||||
|
||||
// Header
|
||||
if ( is_registered_sidebar( 'header-right' ) ) {
|
||||
global $wp_registered_sidebars;
|
||||
$wp_registered_sidebars['ss-header-right-temp'] = $wp_registered_sidebars['header-right'];
|
||||
unset( $wp_registered_sidebars['header-right'] );
|
||||
add_action( 'genesis_header_right', array( $this, 'do_header_right' ) );
|
||||
}
|
||||
|
||||
// Sidebars
|
||||
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
|
||||
remove_action( 'genesis_sidebar_alt', 'genesis_do_sidebar_alt' );
|
||||
add_action( 'genesis_sidebar', array( $this, 'do_primary_sidebar' ) );
|
||||
@@ -72,6 +81,23 @@ class Genesis_Simple_Sidebars_Core {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Output custom header widget area, if one is set. Otherwise output default.
|
||||
*
|
||||
* @since 2.1.0
|
||||
*/
|
||||
public function do_header_right() {
|
||||
|
||||
global $wp_registered_sidebars;
|
||||
|
||||
if ( ! $this->do_sidebar( '_ss_header' ) ) {
|
||||
$wp_registered_sidebars['header-right'] = $wp_registered_sidebars['ss-header-right-temp'];
|
||||
}
|
||||
|
||||
unset( $wp_registered_sidebars['ss-header-right-temp'] );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Output custom primary sidebar, if one is set. Otherwise output default.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user