Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Fix for empty widget areas not showing up
Browse files Browse the repository at this point in the history
  • Loading branch information
jmr06005 committed Feb 13, 2015
1 parent 4117b86 commit e0273d3
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions css/widgets-area.php
Original file line number Diff line number Diff line change
Expand Up @@ -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; } ';

?>

0 comments on commit e0273d3

Please sign in to comment.