[wp-trac] Re: [WordPress Trac] #4313: Automatically activate Widgets

WordPress Trac wp-trac at lists.automattic.com
Tue May 22 20:33:20 GMT 2007


#4313: Automatically activate Widgets
----------------------------+-----------------------------------------------
 Reporter:  kretzschmar     |        Owner:  anonymous
     Type:  enhancement     |       Status:  reopened 
 Priority:  low             |    Milestone:  2.4      
Component:  Administration  |      Version:           
 Severity:  minor           |   Resolution:           
 Keywords:  2nd-opinion     |  
----------------------------+-----------------------------------------------
Comment (by Otto42):

 Replying to [comment:6 kretzschmar]:
 > It does return false BUT I have 6 Sidebars and I would like to check if
 ALL of them aren't populated. If one is, the widgets are automatically
 displayed from that function.

 {{{
 function exist_active_widgets()
 $sidebars_widgets = wp_get_sidebars_widgets();
 foreach ($sidebars_widgets as $sidebar)
   if (!empty($sidebar)) return true;
 return false;
 }
 ...
 if (!exist_active_widgets())
 echo "User has no active widgets in any sidebar.";
 }}}

 That help any?

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4313#comment:8>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list