From 4117b86252bc006d9563ae9181dba67a35c87e13 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Fri, 13 Feb 2015 14:25:31 -0500 Subject: [PATCH 1/3] Update to fix home 8-30 bug --- css/widgets-area.php | 49 +++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/css/widgets-area.php b/css/widgets-area.php index 8ca618a..a57cdfc 100644 --- a/css/widgets-area.php +++ b/css/widgets-area.php @@ -1,22 +1,29 @@ - $index ){ - $index = $i; //$index is the biggest home widget area that has widgets, the next widget area doesn't have widgets - } - } - } - $start = ++$index; - for ($i=$start; $i < 31; $i++) { - echo '#home'.$i.'{ display:none; } '; - } + $index ){ + $index = $i; //$index is the biggest home widget area that has widgets, the next widget area doesn't have widgets + } + } + } + $start = ++$index; + $hidehomes = array(); + $showhomes = array(); + for ($i=$start; $i < 61; $i++) { + $hidehomes[] = '#home'.$i; + } + for ($i=1; $i < $start; $i++) { + $showhomes[] = '#home'.$i; + } + echo implode(', ',$hidehomes).' { display:none; } '; + echo implode(', ',$showhomes).' { display:block; } '; ?> \ No newline at end of file From e0273d332648296cfe1596226930e3d491855634 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Fri, 13 Feb 2015 14:47:18 -0500 Subject: [PATCH 2/3] Fix for empty widget areas not showing up --- css/widgets-area.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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 From 0ce94ef6880b730d62ba30ee5f59f74a89b1b9a5 Mon Sep 17 00:00:00 2001 From: Joshua Roy Date: Tue, 17 Feb 2015 10:16:54 -0500 Subject: [PATCH 3/3] Modify page-home.php to display empty widget areas when in theme customizer --- page-home.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/page-home.php b/page-home.php index 14da127..5dd72fe 100644 --- a/page-home.php +++ b/page-home.php @@ -8,7 +8,8 @@ */ $rows = get_theme_mod('homepagerows', '2'); $count = 1; -get_header(); ?> +get_header(); +?>
@@ -23,10 +24,18 @@ ?>
- - - - + +
+

Home

+ We're in the customizer, this widget area is empty. +
+