Prevent errors in assigning widgets to sidebars for themes with dynamic sidebars, props batmoo, fixes #19274

git-svn-id: http://svn.automattic.com/wordpress/trunk@19334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2011-11-18 07:00:26 +00:00
parent 83e2ae14d4
commit 2d6d3c748a
1 changed files with 15 additions and 12 deletions

View File

@ -62,18 +62,21 @@ foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
if ( 'wp_inactive_widgets' == $sidebar_id )
continue;
if ( empty( $wp_registered_sidebars[ $sidebar_id ] ) && ! empty( $widgets ) ) {
// register the inactive_widgets area as sidebar
register_sidebar(array(
'name' => __( 'Inactive Sidebar (from previous theme)' ),
'id' => $sidebar_id,
'class' => 'inactive-sidebar orphan-sidebar',
'description' => __( 'This is a left over sidebar from an old theme and does not show anywhere on your site' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar
register_sidebar(array(
'name' => __( 'Inactive Sidebar (from previous theme)' ),
'id' => $sidebar_id,
'class' => 'inactive-sidebar orphan-sidebar',
'description' => __( 'This is a left over sidebar from an old theme and does not show anywhere on your site' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
} else {
unset( $sidebars_widgets[ $sidebar_id ] );
}
}
}