-
Notifications
You must be signed in to change notification settings - Fork 4
/
sidebar.php
140 lines (91 loc) · 3.53 KB
/
sidebar.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
* The sidebar template containing the main widget area
*
* @package Inti
* @subpackage Templates
* @since 1.0.0
* @version 1.5.0
*/
// get the page layout
wp_reset_postdata();
$layout = inti_get_layout(get_inti_option('', '', '', '_inti_layout_radio'));
$sticky = inti_get_sticky_sidebars(get_inti_option('', '', '', '_inti_layout_stickysidebars'));
?>
<?php inti_hook_sidebar_before(); ?>
<?php
// Build column classes depending on layout
$column_classes = "";
$has_sidebar = true;
switch ($layout) {
case '1c':
case '1c-thin':
$has_sidebar = false;
break;
case '2c-l':
$column_classes = "small-12 medium-5 large-4";
break;
case '2c-r':
$column_classes = "small-12 medium-5 medium-order-1 large-4";
break;
}
// Display the right sidebar for the template
if ( is_front_page() && $has_sidebar ) : ?>
<?php if ($sticky == "sticky" && current_theme_supports('inti-sticky-sidebars')): ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary" data-sticky-container>
<div class="sticky" data-sticky data-anchor="content" data-margin-top="0">
<?php dynamic_sidebar('sidebar-frontpage'); ?>
</div>
</div><!-- #sidebar -->
<?php else : ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary">
<?php dynamic_sidebar('sidebar-frontpage'); ?>
</div><!-- #sidebar -->
<?php endif; ?>
<?php // pages
elseif ( is_page() && $has_sidebar ) : ?>
<?php if ($sticky == "sticky" && current_theme_supports('inti-sticky-sidebars')): ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary" data-sticky-container>
<div class="sticky" data-sticky data-anchor="content" data-margin-top="0">
<?php dynamic_sidebar('sidebar'); ?>
</div>
</div><!-- #sidebar -->
<?php else : ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary">
<?php dynamic_sidebar('sidebar'); ?>
</div><!-- #sidebar -->
<?php endif; ?>
<?php // blog indexes
elseif ( ( is_archive() || is_home() || is_search() ) && $has_sidebar ) : ?>
<?php if ($sticky == "sticky" && current_theme_supports('inti-sticky-sidebars')): ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary" data-sticky-container>
<div class="sticky" data-sticky data-anchor="content" data-margin-top="0">
<?php dynamic_sidebar('sidebar'); ?>
</div>
</div><!-- #sidebar -->
<?php else : ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary">
<?php dynamic_sidebar('sidebar'); ?>
</div><!-- #sidebar -->
<?php endif; ?>
<?php // blog single
elseif ( is_single() && $has_sidebar ) : ?>
<?php if ($sticky == "sticky" && current_theme_supports('inti-sticky-sidebars')): ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary" data-sticky-container>
<div class="sticky" data-sticky data-anchor="content" data-margin-top="0">
<?php dynamic_sidebar('sidebar'); ?>
</div>
</div><!-- #sidebar -->
<?php else : ?>
<div id="sidebar" class="sidebar <?php echo $column_classes; ?> cell" role="complementary">
<?php dynamic_sidebar('sidebar'); ?>
</div><!-- #sidebar -->
<?php endif; ?>
<?php
elseif ( is_post_type_archive('inti-example-post-type') && $has_sidebar ) : ?>
<!-- add sidebar here -->
<?php
elseif ( 'inti-example-post-type' == get_post_type() && $has_sidebar ) : ?>
<!-- add sidebar here -->
<?php endif; ?>
<?php inti_hook_sidebar_after(); ?>