diff --git a/css/widgets-area.php b/css/widgets-area.php index a57cdfc..2f3d9c4 100644 --- a/css/widgets-area.php +++ b/css/widgets-area.php @@ -6,24 +6,26 @@ header("Content-type: text/css; charset: UTF-8"); header('Cache-control: must-revalidate'); - $sidebars = wp_get_sidebars_widgets(); - $index = 0; - for ($i=1; $i < 31 ; $i++) { - if( !empty($sidebars['home'.$i]) ){ - if( $i > $index ){ - $index = $i; //$index is the biggest home widget area that has widgets, the next widget area doesn't have widgets - } + $rows = get_theme_mod('homepagerows', '2'); + $count = 1; + for($i=0; $i<$rows; $i++){ + $widths = get_theme_mod('homepage_'.$i, '12'); + $widths = explode(',',$widths); + if(count($widths) == 1) $widths[0] = 12; + foreach($widths as $width){ + if($width == 0) break; + $count++; } } - $start = ++$index; $hidehomes = array(); $showhomes = array(); - for ($i=$start; $i < 61; $i++) { + for ($i=$count; $i < 61; $i++) { $hidehomes[] = '#home'.$i; } - for ($i=1; $i < $start; $i++) { + for ($i=1; $i < $count; $i++) { $showhomes[] = '#home'.$i; } echo implode(', ',$hidehomes).' { display:none; } '; echo implode(', ',$showhomes).' { display:block; } '; + ?> \ No newline at end of file