-
Notifications
You must be signed in to change notification settings - Fork 0
/
sidebar.php
188 lines (177 loc) · 7.39 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?php
/*
===================================================================================================
WARNING! DO NOT EDIT THIS FILE OR ANY TEMPLATE FILES IN THIS THEME!
To make it easy to update your theme, you should not edit this file. Instead, you should create a
Child Theme first. This will ensure your template changes are not lost when updating the theme.
You can learn more about creating Child Themes here: http://codex.wordpress.org/Child_Themes
You have been warned! :)
===================================================================================================
*/
?>
<?php
if(is_page()):
if(have_posts()): while(have_posts()): the_post();
$page_options_meta = get_post_meta($post->ID,'_page_options',true);
if(isset($page_options_meta['ct_page_layout'])):
$page_layout = $page_options_meta['ct_page_layout'];
else:
$page_layout = null;
endif;
if(isset($page_options_meta['ct_page_sidebar'])):
$page_sidebar = $page_options_meta['ct_page_sidebar'];
else:
$page_sidebar = null;
endif;
endwhile; endif;
endif;
$post_type = get_query_var('post_type');
$theme_options = get_option('ct_theme_options');
$search_results_layout = $theme_options['search_results_layout'];
$search_results_sidebar = $theme_options['search_results_sidebar'];
$post_settings = get_option('ct_post_settings');
$post_archive_layout = $post_settings['archive_layout'];
$post_archive_sidebar = $post_settings['archive_sidebar'];
$post_single_layout = $post_settings['single_layout'];
$post_single_sidebar = $post_settings['single_sidebar'];
$sermon_settings = get_option('ct_sermon_settings');
$sm_archive_layout = $sermon_settings['archive_layout'];
$sm_archive_sidebar = $sermon_settings['archive_sidebar'];
$sm_single_layout = $sermon_settings['single_layout'];
$sm_single_sidebar = $sermon_settings['single_sidebar'];
$location_settings = get_option('ct_location_settings');
$loc_archive_layout = $location_settings['archive_layout'];
$loc_archive_sidebar = $location_settings['archive_sidebar'];
$loc_single_layout = $location_settings['single_layout'];
$loc_single_sidebar = $location_settings['single_sidebar'];
$person_settings = get_option('ct_person_settings');
$ppl_archive_layout = $person_settings['archive_layout'];
$ppl_archive_sidebar = $person_settings['archive_sidebar'];
$ppl_single_layout = $person_settings['single_layout'];
$ppl_single_sidebar = $person_settings['single_sidebar'];
?>
<?php
if(
((is_page() || is_singular('event') || is_singular('location')) && ($page_layout == 'right' || empty($page_layout))) ||
((is_search() && $post_type != 'ct_sermon') && ($search_results_layout == 'right' || empty($search_results_layout))) ||
((is_post_type_archive('post') || is_day() || is_month() || is_year() || is_tag() || is_category() || is_author()) && ($post_archive_layout == 'right' || empty($post_archive_layout))) ||
(is_singular('post') && ($post_single_layout == 'right' || empty($post_single_layout))) ||
((is_post_type_archive('ct_sermon') || is_tax('sermon_speaker') || is_tax('sermon_series') || is_tax('sermon_service') || is_tax('sermon_topic')) && ($sm_archive_layout == 'right' || empty($sm_archive_layout))) ||
(is_singular('ct_sermon') && ($sm_single_layout == 'right' || empty($sm_single_layout))) ||
((is_post_type_archive('ct_location') || is_tax('location_tag')) && ($loc_archive_layout == 'right' || empty($loc_archive_layout))) ||
(is_singular('ct_location') && ($loc_single_layout == 'right' || empty($loc_single_layout))) ||
((is_post_type_archive('ct_person') || is_tax('person_tag') || is_tax('person_category')) && ($ppl_archive_layout == 'right' || empty($ppl_archive_layout))) ||
(is_singular('ct_person') && ($ppl_single_layout == 'right' || empty($ppl_single_layout)))
):
?>
<div id="sidebar" class="grid_4 grid-33 omega">
<div class="widgets-wrapper">
<?php
elseif(
((is_page() || is_singular('event') || is_singular('location')) && $page_layout == 'left') ||
((is_search() && $post_type != 'ct_sermon') && $search_results_layout == 'left') ||
((is_post_type_archive('post') || is_day() || is_month() || is_year() || is_tag() || is_category() || is_author()) && $post_archive_layout == 'left') ||
(is_singular('post') && $post_single_layout == 'left') ||
((is_post_type_archive('ct_sermon') || is_tax('sermon_speaker') || is_tax('sermon_series') || is_tax('sermon_service') || is_tax('sermon_topic')) && $sm_archive_layout == 'left') ||
(is_singular('ct_sermon') && $sm_single_layout == 'left') ||
((is_post_type_archive('ct_location') || is_tax('location_tag')) && $loc_archive_layout == 'left') ||
(is_singular('ct_location') && $loc_single_layout == 'left') ||
((is_post_type_archive('ct_person') || is_tax('person_tag') || is_tax('person_category')) && $ppl_archive_layout == 'left') ||
(is_singular('ct_person') && $ppl_single_layout == 'left')
):
?>
<div id="sidebar" class="grid_4 grid-33 alpha">
<div class="widgets-wrapper">
<?php endif; ?>
<?php
if(is_page() || is_singular('event') || is_singular('location')):
if($page_sidebar):
dynamic_sidebar($page_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_search() && $post_type != 'ct_sermon'):
if($search_results_sidebar):
dynamic_sidebar($search_results_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_post_type_archive('post') || is_day() || is_month() || is_year() || is_tag() || is_category() || is_author()):
if($post_archive_sidebar):
dynamic_sidebar($post_archive_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_singular('post')):
if($post_single_sidebar):
dynamic_sidebar($post_single_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_post_type_archive('ct_sermon') || is_tax('sermon_speaker') || is_tax('sermon_series') || is_tax('sermon_service') || is_tax('sermon_topic' || $post_type == 'ct_sermon')):
if($sm_archive_sidebar):
dynamic_sidebar($sm_archive_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_singular('ct_sermon')):
if($sm_single_sidebar):
dynamic_sidebar($sm_single_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_post_type_archive('ct_location') || is_tax('location_tag')):
if($loc_archive_sidebar):
dynamic_sidebar($loc_archive_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_singular('ct_location')):
if($loc_single_sidebar):
dynamic_sidebar($loc_single_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_post_type_archive('ct_person') || is_tax('person_tag') || is_tax('person_category')):
if($ppl_archive_sidebar):
dynamic_sidebar($ppl_archive_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
<?php
if(is_singular('ct_person')):
if($ppl_single_sidebar):
dynamic_sidebar($ppl_single_sidebar);
else:
dynamic_sidebar('primarysidebar');
endif;
endif;
?>
</div>
</div>