-
Notifications
You must be signed in to change notification settings - Fork 40
/
sidebar-footer.php
72 lines (64 loc) · 2.44 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
/**
* The Sidebar containing the footer widget areas.
*
* @package ColorMag
*
* @since ColorMag 1.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* The footer widget area is triggered if any of the areas have widgets. So let's check that first.
*
* If none of the sidebars have widgets, then let's bail early.
*/
if ( ! is_active_sidebar( 'colormag_footer_sidebar_one' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_two' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_three' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_four' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_one_upper' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_two_upper' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_three_upper' ) &&
! is_active_sidebar( 'colormag_footer_sidebar_full_width' ) ) {
return;
}
$footer_column_layout = get_theme_mod( 'colormag_footer_column_layout', 'style-4' );
$number_of_cols = preg_replace( '/\D/', '', $footer_column_layout );
$col_mapper = array(
1 => 'one',
2 => 'two',
3 => 'three',
4 => 'four',
);
?>
<div class="cm-footer-cols">
<div class="cm-container">
<div class="cm-row">
<?php if ( is_active_sidebar( 'colormag_footer_sidebar_one_upper' ) || is_active_sidebar( 'colormag_footer_sidebar_two_upper' ) || is_active_sidebar( 'colormag_footer_sidebar_three_upper' ) ) : ?>
<div class="cm-upper-footer-cols">
<div class="cm-upper-footer-col cm-upper-footer-col--1">
<?php dynamic_sidebar( 'colormag_footer_sidebar_one_upper' ); ?>
</div>
<div class="cm-upper-footer-col cm-upper-footer-col--2">
<?php dynamic_sidebar( 'colormag_footer_sidebar_two_upper' ); ?>
</div>
<div class="cm-upper-footer-col cm-upper-footer-col--3">
<?php dynamic_sidebar( 'colormag_footer_sidebar_three_upper' ); ?>
</div>
</div>
<?php endif; ?>
<?php if ( is_active_sidebar( 'colormag_footer_sidebar_one' ) || is_active_sidebar( 'colormag_footer_sidebar_two' ) || is_active_sidebar( 'colormag_footer_sidebar_three' ) || is_active_sidebar( 'colormag_footer_sidebar_four' ) ) : ?>
<div class="cm-lower-footer-cols">
<?php for ( $i = 1; $i <= $number_of_cols; ++$i ) : ?>
<div class="cm-lower-footer-col cm-lower-footer-col--<?php echo esc_attr( $i ); ?>">
<?php dynamic_sidebar( "colormag_footer_sidebar_{$col_mapper[$i]}" ); ?>
</div>
<?php endfor; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>