/
sidebar-footer.php
executable file
·57 lines (49 loc) · 1.64 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Footer widget areas.
*
* @package WordPress
* @subpackage skeleton
* @since skeleton 0.1
*/
// count the active widgets to determine column sizes
$footerwidgets = is_active_sidebar('footer-widget-area-1') + is_active_sidebar('footer-widget-area-2') + is_active_sidebar('footer-widget-area-3') + is_active_sidebar('footer-widget-area-4');
// default
$footergrid = "one_fourth";
// if only one
if ($footerwidgets == "1") {
$footergrid = "full-width";
// if two, split in half
} elseif ($footerwidgets == "2") {
$footergrid = "one_half";
// if three, divide in thirds
} elseif ($footerwidgets == "3") {
$footergrid = "one_third";
// if four, split in fourths
} elseif ($footerwidgets == "4") {
$footergrid = "one_fourth";
}
?>
<?php if ($footerwidgets) : ?>
<?php if (is_active_sidebar('footer-widget-area-1')) : ?>
<div class="<?php echo $footergrid;?>">
<?php dynamic_sidebar('footer-widget-area-1'); ?>
</div>
<?php endif;?>
<?php if (is_active_sidebar('footer-widget-area-2')) : $last = ($footerwidgets == '2' ? ' last' : false);?>
<div class="<?php echo $footergrid.$last;?>">
<?php dynamic_sidebar('footer-widget-area-2'); ?>
</div>
<?php endif;?>
<?php if (is_active_sidebar('footer-widget-area-3')) : $last = ($footerwidgets == '3' ? ' last' : false);?>
<div class="<?php echo $footergrid.$last;?>">
<?php dynamic_sidebar('footer-widget-area-3'); ?>
</div>
<?php endif;?>
<?php if (is_active_sidebar('footer-widget-area-4')) : $last = ($footerwidgets == '4' ? ' last' : false);?>
<div class="<?php echo $footergrid.$last;?>">
<?php dynamic_sidebar('footer-widget-area-4'); ?>
</div>
<?php endif;?>
<div class="clear"></div>
<?php endif;?>