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

Update to fix home 8-30 bug #103

Merged
merged 3 commits into from
Feb 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 30 additions & 21 deletions css/widgets-area.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
<?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');

$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++;
}
}
$hidehomes = array();
$showhomes = array();
for ($i=$count; $i < 61; $i++) {
$hidehomes[] = '#home'.$i;
}
for ($i=1; $i < $count; $i++) {
$showhomes[] = '#home'.$i;
}
echo implode(', ',$hidehomes).' { display:none; } ';
echo implode(', ',$showhomes).' { display:block; } ';

?>
19 changes: 14 additions & 5 deletions page-home.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/
$rows = get_theme_mod('homepagerows', '2');
$count = 1;
get_header(); ?>
get_header();
?>

<div id="page-home">
<?php while ( have_posts() ) : the_post(); ?>
Expand All @@ -23,10 +24,18 @@
?>
<div class="col-sm-<?php echo $width; ?>">
<div class="home-section" id="home-section-<?php echo $count; ?>">
<?php if ( is_active_sidebar( 'home'.$count ) ) { ?>
<?php dynamic_sidebar( 'home'.$count ); ?>
<?php } else { ?>
<?php }; ?>
<?php if ( is_active_sidebar( 'home'.$count ) ) {
dynamic_sidebar( 'home'.$count );
} elseif(isset( $wp_customize )) {
?>
<div class="widget">
<h3>Home <?php echo $count; ?></h3>
We're in the customizer, this widget area is empty.
</div>
<?php
} else {

}?>
</div>
</div>
<?php $count ++; } ?>
Expand Down