-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsidebar-front.php
38 lines (35 loc) · 1.18 KB
/
sidebar-front.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* The sidebar containing the front page widget areas.
* If there are no active widgets, the sidebar will be hidden completely.
*
* @package Quark
* @since Quark 1.0
*/
?>
<?php
// Count how many front page sidebars are active so we can work out how many containers we need
$footerSidebars = 0;
for ( $x=1; $x<=4; $x++ ) {
if ( is_active_sidebar( 'sidebar-homepage' . $x ) ) {
$footerSidebars++;
}
}
// If there's one or more one active sidebars, create a row and add them
if ( $footerSidebars > 0 ) { ?>
<div id="secondary" class="home-sidebar row">
<?php
// Work out the container class name based on the number of active front page sidebars
$containerClass = "grid_" . 12 / $footerSidebars . "_of_12";
// Display the active front page sidebars
for ( $x=1; $x<=4; $x++ ) {
if ( is_active_sidebar( 'sidebar-homepage'. $x ) ) { ?>
<div class="col <?php echo $containerClass?>">
<div class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-homepage'. $x ); ?>
</div> <!-- #widget-area -->
</div> <!-- /.col.<?php echo $containerClass?> -->
<?php }
} ?>
</div> <!-- /#secondary.row -->
<?php } ?>