-
Notifications
You must be signed in to change notification settings - Fork 0
/
single-feature.php
258 lines (197 loc) · 9.42 KB
/
single-feature.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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<?php get_header(); ?>
<main class="dark-theme">
<section class="features-hero single-feature">
<div class="area flex gap-20 align-bottom">
<div class="icon faeture-icon-big">
<img src="<?php echo get_template_directory_uri(); ?><?php the_field('feature_icon_path')?>" />
</div>
<div class=" resp-logo">
<img src="<?php echo get_template_directory_uri(); ?>/img/logos/logo-white.svg" />
</div>
<div class="col-half">
<div class="sub-section flex align-center">
<div class="icon small">
<img src="<?php echo get_template_directory_uri(); ?>/img/icons/features.svg" />
</div>
<div class="breadcrumbs">
<a href="<?php echo home_url(); ?>/features/">Features</a> >
<a href="<?php echo home_url(); ?>/features/<?php
$terms = get_the_terms( $post->ID , 'group' );
if ( $terms != null ){
foreach( $terms as $term ) {
print $term->slug ;
unset($term);
} } ?>">
<?php
$terms = get_the_terms( $post->ID , 'group' );
if ( $terms != null ){
foreach( $terms as $term ) {
print $term->name ;
unset($term);
} } ?>
</a> > <?php the_title(); ?>
</div>
</div>
<h1 class="title-big"><?php the_title(); ?></h1>
<?php if( get_field('feature_short_description') ): ?>
<p class="text-28 light-blu"><?php the_field('feature_short_description') ?></p>
<?php endif;?>
</div>
<div class="col-half">
<?php if( get_field('feature_additional_description') ): ?>
<p class="text-18"><?php the_field('feature_additional_description') ?></p>
<?php endif;?>
</div>
</div>
</section>
<?php if( get_field('gallery_image_1') ): ?>
<section id="features-overview" class="single-feature">
<div class="area with-feature-carousel">
<div id="features-carousel" class="owl-carousel owl-theme">
<div class="feature-carusel-item">
<div class="carousel-image">
<img src="<?php the_field('gallery_image_1') ?>" />
</div>
<div class="carousel-text">
<p class="white text-18 bold"><?php the_field('gallery_content_title_1') ?></p>
<p class="text-16"><?php the_field('gallery_content_1') ?></p>
</div>
</div>
<?php if( get_field('gallery_image_2') ): ?>
<div class="feature-carusel-item">
<div class="carousel-image">
<img src="<?php the_field('gallery_image_2') ?>" />
</div>
<div class="carousel-text">
<p class="white text-18 bold"><?php the_field('gallery_content_title_2') ?></p>
<p class="text-16"><?php the_field('gallery_content_2') ?></p>
</div>
</div>
<?php endif; ?>
<?php if( get_field('gallery_image_3') ): ?>
<div class="feature-carusel-item">
<div class="carousel-image">
<img src="<?php the_field('gallery_image_3') ?>" />
</div>
<div class="carousel-text">
<p class="white text-18 bold"><?php the_field('gallery_content_title_3') ?></p>
<p class="text-16"><?php the_field('gallery_content_3') ?></p>
</div>
</div>
<?php endif; ?>
</div>
</section>
<?php endif; ?>
<section class="feature-details">
<?php if( get_field('additional_detail_1_image') ): ?>
<div id="anchor1" class="area flex gap-50 align-center area-spacer">
<div class="col-half">
<p class="subtitle"><?php the_field('additional_detail_pretitle') ?></p>
<h3 class="title-medium"><?php the_field('additional_detail_title') ?></h3>
<p><?php the_field('additional_detail_content') ?></p>
</div>
<div class="col-half">
<img class="feature-detail-image" src="<?php the_field('additional_detail_1_image') ?>" />
</div>
</div>
<?php endif; ?>
<?php if( get_field('additional_detail_2_image') ): ?>
<div id="anchor2" class="area flex gap-50 align-center area-spacer">
<div class="col-half">
<p class="subtitle"><?php the_field('additional_detail_pretitle_2') ?></p>
<h3 class="title-medium"><?php the_field('additional_detail_title_2') ?></h3>
<p><?php the_field('additional_detail_content_2') ?></p>
</div>
<div class="col-half">
<img class="feature-detail-image" src="<?php the_field('additional_detail_2_image') ?>" />
</div>
</div>
<?php endif; ?>
<?php if( get_field('additional_detail_3_image') ): ?>
<div id="anchor3" class="area flex gap-50 align-center area-spacer">
<div class="col-half">
<p class="subtitle"><?php the_field('additional_detail_pretitle_3') ?></p>
<h3 class="title-medium"><?php the_field('additional_detail_title_3') ?></h3>
<p><?php the_field('additional_detail_content_3') ?></p>
</div>
<div class="col-half">
<img class="feature-detail-image" src="<?php the_field('additional_detail_3_image') ?>" />
</div>
</div>
<?php endif; ?>
</section>
<section class="related-features">
<div class="area with-titles flex align-bottom">
<div class="col-full">
<div class="sub-section flex align-center">
<div class="icon small">
<img src="<?php echo get_template_directory_uri(); ?>/img/icons/features.svg" loading="lazy">
</div>
<h2 class="subtitle">Explore Features</h2>
</div>
<p class="title-medium">Related Features</p>
</div>
</div>
</div>
<div class="area flex wrap gap-20">
<?php
//get the taxonomy terms of custom post type
$customTaxonomyTerms = wp_get_object_terms( $post->ID, 'group', array('fields' => 'ids') );
//query arguments
$args = array(
'post_type' => 'feature',
'post_status' => 'publish',
'posts_per_page' => 20,
'orderby' => 'rand',
'tax_query' => array(
array(
'taxonomy' => 'group',
'field' => 'id',
'terms' => $customTaxonomyTerms
)
),
'post__not_in' => array ($post->ID),
);
//the query
$relatedPosts = new WP_Query( $args );
//loop through query
if($relatedPosts->have_posts()){
while($relatedPosts->have_posts()){
$relatedPosts->the_post();
?>
<div class="col-4">
<a class="nostyle" href="<?php the_permalink(); ?>">
<div class="generic-card feat glow-back has-link">
<div class="wrappo">
<div class="icon in-card">
<img
src="<?php echo get_template_directory_uri(); ?><?php the_field('feature_icon_path')?>" />
</div>
<h3 class="title-medium"><?php the_title(); ?></h3>
<p><?php the_field('feature_short_description') ?></p>
<div class="fake-button space">
<p>Discover</p>
</div>
</div>
</div>
</a>
</div>
<?php
}
}else{
//no posts found
}
//restore original post data
wp_reset_postdata();
?>
</div>
</section>
<section class="cta">
<div class="area">
<?php
include ('incl/maincta.php') ;
?>
</div>
</section>
</main>
<?php get_footer(); ?>