Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function sog_count_wdgt_areas( $areas ) {
- $widget_areas = ( is_array($areas) ? $areas : false );
- if( ! $widget_areas ) {
- return 'inactive';
- } else {
- $count = 0;
- foreach( $widget_areas as $container ) {
- // $count++;
- if( is_active_sidebar( $container ) ) {
- $count++;
- }
- }
- return $count;
- }
- }
- $areas = array( 'area_1', 'area_2', 'area_3' );
- echo sog_count_wdgt_areas( $areas ); // returns 1 even if all sidebars are active
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement