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

Philip M. Hofer (Frumph) philip at frumph.net
Sat Oct 9 07:41:21 UTC 2010


If when you register your sidebars you include an id => with it, you can 
utilize the ID instead of making core changes


----- Original Message ----- 
From: "David Morris" <dvmorris at gmail.com>
To: <wp-hackers at lists.automattic.com>
Sent: Friday, October 08, 2010 9:47 AM
Subject: Re: [wp-hackers] Displaying a sidebar only if it contains widgets


> 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;
> }
> }
> }
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
> 




More information about the wp-hackers mailing list