[wp-hackers] Displaying a sidebar only if it contains widgets

David Morris dvmorris at gmail.com
Fri Oct 8 16:47:05 UTC 2010


Changing the first line in that function to this works:

                global $wp_registered_sidebars;
 if ( is_int($index) ) {
 $index = "sidebar-$index";
 } else {
 $index = sanitize_title($index);
 foreach ( (array) $wp_registered_sidebars as $key => $value ) {
 if ( sanitize_title($value['name']) == $index ) {
 $index = $key;
 break;
 }
 }
 }


More information about the wp-hackers mailing list