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

Commit

Permalink
Update to fix home 8-30 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jmr06005 committed Feb 13, 2015
1 parent 416a847 commit 4117b86
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions css/widgets-area.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
<?php
$absolute_path = explode('wp-content', $_SERVER['SCRIPT_FILENAME']);
$wp_load = $absolute_path[0] . 'wp-load.php';
require_once($wp_load);

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
}
}
}
$start = ++$index;
for ($i=$start; $i < 31; $i++) {
echo '#home'.$i.'{ display:none; } ';
}
<?php
$absolute_path = explode('wp-content', $_SERVER['SCRIPT_FILENAME']);
$wp_load = $absolute_path[0] . 'wp-load.php';
require_once($wp_load);

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
}
}
}
$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; } ';
?>

0 comments on commit 4117b86

Please sign in to comment.