-
Notifications
You must be signed in to change notification settings - Fork 2
/
sidebar-footer.php
38 lines (35 loc) · 1.21 KB
/
sidebar-footer.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 footer widget areas.
* If there are no active widgets, the sidebar will be hidden completely.
*
* @package Ephemeris
* @since Ephemeris 1.0
*/
?>
<?php
// Count how many footer 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-footer' . $x ) ) {
$footerSidebars++;
}
}
// If there's one or more one active sidebars, create a row and add them
if ( $footerSidebars > 0 ) { ?>
<footer class="site-footer grid-container" role="contentinfo">
<?php
// Work out the container class name based on the number of active footer sidebars
$containerClass = "grid-" . intval( 100 / $footerSidebars ) . " tablet-grid-" . intval( 100 / $footerSidebars ) . " mobile-grid-100";
// Display the active footer sidebars
for ( $x=1; $x<=4; $x++ ) {
if ( is_active_sidebar( 'sidebar-footer'. $x ) ) { ?>
<div class="<?php echo $containerClass?>">
<div class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-footer'. $x ); ?>
</div>
</div> <!-- /.<?php echo $containerClass?> -->
<?php }
} ?>
</footer> <!-- /.site-footer.grid-container -->
<?php } ?>