[wp-hackers] Displaying a sidebar only if it contains widgets
David Morris
dvmorris at gmail.com
Fri Oct 8 16:44:30 UTC 2010
Hmm, that doesn't seem to be working for me. I have widgets in a sidebar and
I call that function, and it returns false.
I checked into that function, and it does not seem to be able to use the
sidebar name. It checks $sidebars_widgets[$index], and my $sidebars_widgets
array looks like this:
[sidebar-1] => Array
(
[0] => archives-4
[1] => text-4
)
[sidebar-2] => Array
(
[0] => text-3
[1] => archives-3
)
[sidebar-3] => Array
(
)
When I pass my sidebar's name, it's not getting translated into an ID, so it
looks like the sidebar is never active because it can't find that index.
Dave
On Fri, Oct 8, 2010 at 10:59 AM, Philip M. Hofer (Frumph) <philip at frumph.net
> wrote:
> the function is_active_sidebar('sidebarname') can be used, it returns true
> if there's a widget inside and active inside
>
> if (is_active_sidebar('footer')) get_sidebar('footer');
>
>
> ----- Original Message ----- From: "David Morris" <dvmorris at gmail.com>
> To: <wp-hackers at lists.automattic.com>
> Sent: Friday, October 08, 2010 8:55 AM
> Subject: [wp-hackers] Displaying a sidebar only if it contains widgets
>
>
> Is there an easy way to check if a sidebar contains widgets before
>> displaying it?
>>
>> Thanks,
>> Dave
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Dave Morris
http://dave.showviz.net/
http://3dcamphouston.com/
More information about the wp-hackers
mailing list