Check the sidebar class for orphaned sidebars, match sidebars by id while retrieving orphans and the theme has not changed, props SergeyBiryukov, fixes #19350

git-svn-id: https://develop.svn.wordpress.org/trunk@19455 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2011-11-26 06:16:43 +00:00
parent 9ad74044d1
commit b627c99686
2 changed files with 17 additions and 11 deletions
+3 -3
View File
@@ -96,7 +96,7 @@ foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar
register_sidebar(array(
'name' => __( 'Inactive Sidebar (not used)' ),
'id' => 'orphaned_widgets-' . $sidebar_id,
'id' => $sidebar_id,
'class' => 'inactive-sidebar orphan-sidebar',
'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ),
'before_widget' => '',
@@ -344,7 +344,7 @@ require_once( './admin-header.php' ); ?>
<?php
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
$wrap_class = 'widgets-holder-wrap';
if ( !empty( $registered_sidebar['class'] ) )
$wrap_class .= ' ' . $registered_sidebar['class'];
@@ -376,7 +376,7 @@ foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
<?php
$i = 0;
foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
if ( 'wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) )
continue;
$wrap_class = 'widgets-holder-wrap';