forked from Dravenrip/avada
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faqs.php
212 lines (199 loc) · 6.55 KB
/
faqs.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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
// Template Name: FAQs
get_header(); ?>
<?php
$content_css = 'width:100%';
$sidebar_css = 'display:none';
$content_class = '';
$sidebar_exists = false;
$sidebar_left = '';
$double_sidebars = false;
$sidebar_1 = get_post_meta( $post->ID, 'sbg_selected_sidebar_replacement', true );
$sidebar_2 = get_post_meta( $post->ID, 'sbg_selected_sidebar_2_replacement', true );
if( $smof_data['pages_global_sidebar'] ) {
if( $smof_data['pages_sidebar'] != 'None' ) {
$sidebar_1 = array( $smof_data['pages_sidebar'] );
} else {
$sidebar_1 = '';
}
if( $smof_data['pages_sidebar_2'] != 'None' ) {
$sidebar_2 = array( $smof_data['pages_sidebar_2'] );
} else {
$sidebar_2 = '';
}
}
if( ( is_array( $sidebar_1 ) && ( $sidebar_1[0] || $sidebar_1[0] === '0' ) ) && ( is_array( $sidebar_2 ) && ( $sidebar_2[0] || $sidebar_2[0] === '0' ) ) ) {
$double_sidebars = true;
}
if( ( is_array( $sidebar_1 ) && ( $sidebar_1[0] || $sidebar_1[0] === '0' ) ) || ( is_array( $sidebar_2 ) && ( $sidebar_2[0] || $sidebar_2[0] === '0' ) ) ) {
$sidebar_exists = true;
} else {
$sidebar_exists = false;
}
if( ! $sidebar_exists ) {
$content_css = 'width:100%';
$sidebar_css = 'display:none';
$sidebar_exists = false;
} elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'left') {
$content_css = 'float:right;';
$sidebar_css = 'float:left;';
$content_class = 'portfolio-one-sidebar';
$sidebar_exists = true;
$sidebar_left = 1;
} elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'right') {
$content_css = 'float:left;';
$sidebar_css = 'float:right;';
$content_class = 'portfolio-one-sidebar';
$sidebar_exists = true;
} elseif(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'default' || ! metadata_exists( 'post', $post->ID, 'pyre_sidebar_position' )) {
$content_class = 'portfolio-one-sidebar';
if($smof_data['default_sidebar_pos'] == 'Left') {
$content_css = 'float:right;';
$sidebar_css = 'float:left;';
$sidebar_exists = true;
$sidebar_left = 1;
} elseif($smof_data['default_sidebar_pos'] == 'Right') {
$content_css = 'float:left;';
$sidebar_css = 'float:right;';
$sidebar_exists = true;
$sidebar_left = 2;
}
}
if(get_post_meta($post->ID, 'pyre_sidebar_position', true) == 'right') {
$sidebar_left = 2;
}
if( $smof_data['pages_global_sidebar'] ) {
if( $smof_data['pages_sidebar'] != 'None' ) {
$sidebar_1 = $smof_data['pages_sidebar'];
if( $smof_data['default_sidebar_pos'] == 'Right' ) {
$content_css = 'float:left;';
$sidebar_css = 'float:right;';
$sidebar_left = 2;
} else {
$content_css = 'float:right;';
$sidebar_css = 'float:left;';
$sidebar_left = 1;
}
}
if( $smof_data['pages_sidebar_2'] != 'None' ) {
$sidebar_2 = $smof_data['pages_sidebar_2'];
}
if( $smof_data['pages_sidebar'] != 'None' && $smof_data['pages_sidebar_2'] != 'None' ) {
$double_sidebars = true;
}
} else {
$sidebar_1 = '0';
$sidebar_2 = '0';
}
if($double_sidebars == true) {
$content_css = 'float:left;';
$sidebar_css = 'float:left;';
$sidebar_2_css = 'float:left;';
} else {
$sidebar_left = 1;
}
?>
<div id="content" class="fusion-faqs faqs" style="<?php echo $content_css; ?>">
<?php while(have_posts()): the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php echo avada_render_rich_snippets_for_pages(); ?>
<?php echo avada_featured_images_for_pages(); ?>
<div class="post-content">
<?php the_content(); ?>
<?php avada_link_pages(); ?>
</div>
</div>
<?php endwhile; ?>
<?php if( ! post_password_required($post->ID) ): ?>
<?php
$portfolio_category = get_terms('faq_category');
if($portfolio_category):
?>
<ul class="faq-tabs clearfix">
<li class="active"><a data-filter="*" href="#"><?php echo __('All', 'Avada'); ?></a></li>
<?php foreach($portfolio_category as $portfolio_cat): ?>
<li><a data-filter=".<?php echo urldecode($portfolio_cat->slug); ?>" href="#"><?php echo $portfolio_cat->name; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div class="faqs-wrapper">
<div class="accordian fusion-accordian">
<div class="panel-group" id="accordian-one">
<?php
$args = array(
'post_type' => 'avada_faq',
'nopaging' => true
);
$gallery = new WP_Query($args);
$count = 0;
while($gallery->have_posts()): $gallery->the_post();
$count++;
?>
<?php
$item_classes = '';
$item_cats = get_the_terms($post->ID, 'faq_category');
if($item_cats):
foreach($item_cats as $item_cat) {
$item_classes .= urldecode($item_cat->slug) . ' ';
}
endif;
?>
<div class="fusion-panel panel-default faq-item <?php echo $item_classes; ?>">
<?php echo avada_render_rich_snippets_for_pages(); ?>
<div class="panel-heading">
<h4 class="panel-title toggle"><a data-toggle="collapse" class="collapsed" data-parent="#accordian-one" href="#collapse-<?php the_ID(); ?>"><i class="fa-fusion-box"></i><?php the_title(); ?></a></h4>
</div>
<div id="collapse-<?php the_ID(); ?>" class="panel-collapse collapse">
<div class="panel-body toggle-content post-content">
<?php
if($smof_data['faq_featured_image']):
if(has_post_thumbnail()):
?>
<div class="flexslider post-slideshow">
<ul class="slides">
<?php $attachment_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); ?>
<li>
<a href="<?php echo $attachment_image[0]; ?>" rel="prettyPhoto[gallery<?php the_ID(); ?>]" title="<?php echo the_title_attribute('echo=0'); ?>">
<?php the_post_thumbnail('blog-large'); ?>
</a>
</li>
</ul>
</div>
<?php endif; ?>
<?php endif; ?>
<?php the_content(); ?>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php endif; // password check ?>
</div>
<?php if( $sidebar_exists == true ): ?>
<?php wp_reset_query(); ?>
<div id="sidebar" class="sidebar" style="<?php echo $sidebar_css; ?>">
<?php
if($sidebar_left == 1) {
generated_dynamic_sidebar($sidebar_1);
}
if($sidebar_left == 2) {
generated_dynamic_sidebar_2($sidebar_2);
}
?>
</div>
<?php if( $double_sidebars == true ): ?>
<div id="sidebar-2" class="sidebar" style="<?php echo $sidebar_2_css; ?>">
<?php
if($sidebar_left == 1) {
generated_dynamic_sidebar_2($sidebar_2);
}
if($sidebar_left == 2) {
generated_dynamic_sidebar($sidebar_1);
}
?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php get_footer(); ?>