danixland

Untitled

Jul 7th, 2011
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function sog_count_wdgt_areas( $areas ) {
  4.     $widget_areas = ( is_array($areas) ? $areas : false );
  5.     if( ! $widget_areas ) {
  6.         return 'inactive';
  7.     } else {
  8.         $count = 0;
  9.         foreach( $widget_areas as $container ) {
  10. //          $count++;
  11.             if( is_active_sidebar( $container ) ) {
  12.                 $count++;
  13.             }
  14.         }
  15.         return $count;
  16.     }
  17. }
  18. $areas = array( 'area_1', 'area_2', 'area_3' );
  19. echo sog_count_wdgt_areas( $areas ); // returns 1 even if all sidebars are active
  20.  
  21. ?>
RAW Paste Data