-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-home-3.php
442 lines (318 loc) · 14 KB
/
template-home-3.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
<?php
/*template name: Home - Recent Work/Posts */
get_header();
$nectar_options = get_nectar_theme_options();
wp_enqueue_script('flexslider');
if ( class_exists( 'Salient_Home_Slider' ) ) { ?>
<div id="featured" data-caption-animation="<?php echo (!empty($nectar_options['slider-caption-animation']) && $nectar_options['slider-caption-animation'] === '1') ? '1' : '0'; ?>" data-bg-color="<?php if(!empty($nectar_options['slider-bg-color'])) echo esc_attr( $nectar_options['slider-bg-color'] ); ?>" data-slider-height="<?php if(!empty($nectar_options['slider-height'])) echo esc_attr( $nectar_options['slider-height'] ); ?>" data-animation-speed="800" data-advance-speed="<?php if(!empty($nectar_options['slider-advance-speed'])) echo esc_attr( $nectar_options['slider-advance-speed'] ); ?>" data-autoplay="<?php echo esc_attr( $nectar_options['slider-autoplay'] );?>">
<?php
$slides = new WP_Query(
array(
'post_type' => 'home_slider',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
)
);
if ( $slides->have_posts() ) :
?>
<?php
while ( $slides->have_posts() ) :
$slides->the_post();
$alignment = get_post_meta( $post->ID, '_nectar_slide_alignment', true );
$video_embed = get_post_meta( $post->ID, '_nectar_video_embed', true );
$video_m4v = get_post_meta( $post->ID, '_nectar_video_m4v', true );
$video_ogv = get_post_meta( $post->ID, '_nectar_video_ogv', true );
$video_poster = get_post_meta( $post->ID, '_nectar_video_poster', true );
?>
<div class="slide orbit-slide <?php if ( ! empty( $video_embed ) || ! empty( $video_m4v ) || ! empty( $video_ogv ) ) { echo 'has-video'; } else { echo esc_attr( $alignment ); } ?> ">
<?php
$image = get_post_meta( $post->ID, '_nectar_slider_image', true );
if( $image ) {
$image = nectar_options_img($image);
}
?>
<article data-background-cover="<?php echo ( ! empty( $nectar_options['slider-background-cover'] ) && $nectar_options['slider-background-cover'] === '1' ) ? '1' : '0'; ?>" style="background-image: url('<?php echo esc_url( $image ); ?>')">
<div class="container">
<div class="col span_12">
<div class="post-title">
<?php
$wp_version = floatval( get_bloginfo( 'version' ) );
// video embed
if ( ! empty( $video_embed ) ) {
echo '<div class="video">' . do_shortcode( $video_embed ) . '</div>';
}
// self hosted video post 3-6
elseif ( $wp_version >= '3.6' ) {
if ( ! empty( $video_m4v ) || ! empty( $video_ogv ) ) {
$video_output = '[video ';
if ( ! empty( $video_m4v ) ) {
$video_output .= 'mp4="' . esc_url( $video_m4v ) . '" '; }
if ( ! empty( $video_ogv ) ) {
$video_output .= 'ogv="' . esc_url( $video_ogv ) . '"'; }
$video_output .= ' poster="' . esc_url( $video_poster ) . '"]';
echo '<div class="video">' . do_shortcode( $video_output ) . '</div>';
}
}
?>
<?php
// mobile more info button for video
if ( ! empty( $video_embed ) || ! empty( $video_m4v ) ) {
echo '<div><a href="#" class="more-info"><span class="mi">' . esc_html__( 'More Info', 'salient' ) . '</span><span class="btv">' . esc_html__( 'Back to Video', 'salient' ) . '</span></a></div>'; }
?>
<?php $caption = get_post_meta( $post->ID, '_nectar_slider_caption', true ); ?>
<h2 data-has-caption="<?php echo ( ! empty( $caption ) ) ? '1' : '0'; ?>"><span>
<?php echo wp_kses_post( $caption ); ?>
</span></h2>
<?php
$button = get_post_meta( $post->ID, '_nectar_slider_button', true );
$button_url = get_post_meta( $post->ID, '_nectar_slider_button_url', true );
if ( ! empty( $button ) ) {
?>
<a href="<?php echo esc_url( $button_url ); ?>" class="uppercase"><?php echo wp_kses_post( $button ); ?></a>
<?php } ?>
</div><!--/post-title-->
</div>
</div>
</article>
</div>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php } ?>
<div class="home-wrap">
<div class="container main-content">
<div class="row">
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
the_content();
endwhile;
endif;
?>
</div><!--/row-->
<?php
if( class_exists('Salient_Portfolio') ) {
$portfolio_link = get_portfolio_page_link( get_the_ID() );
if ( ! empty( $nectar_options['main-portfolio-link'] ) ) {
$portfolio_link = $nectar_options['main-portfolio-link'];
}
$portfolio = array(
'posts_per_page' => '6',
'post_type' => 'portfolio',
);
query_posts( $portfolio );
?>
<?php if ( have_posts() ) { ?>
<div class="carousel-wrap recent-work-carousel" data-full-width="false">
<div class="carousel-heading">
<div class="container">
<h2 class="uppercase"><?php echo ( ! empty( $nectar_options['carousel-title'] ) ) ? esc_html( $nectar_options['carousel-title'] ) : 'Recent Work'; ?><a href="<?php echo esc_url( $portfolio_link ); ?>" class="button"> / <?php echo ( ! empty( $nectar_options['carousel-link'] ) ) ? esc_html( $nectar_options['carousel-link'] ) : 'View all work'; ?></a></h2>
<div class="control-wrap"><a class="carousel-prev" href="#"><i class="icon-angle-left"></i></a>
<a class="carousel-next" href="#"><i class="icon-angle-right"></i></a></div>
</div>
</div>
<ul class="row portfolio-items text-align-center carousel" data-scroll-speed="800" data-easing="easeInOutQuart">
<?php } ?>
<?php
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<li class="col span_4">
<div class="work-item">
<?php
// custom thumbnail
$custom_thumbnail = get_post_meta( $post->ID, '_nectar_portfolio_custom_thumbnail', true );
if ( ! empty( $custom_thumbnail ) ) {
echo '<img class="custom-thumbnail" src="' . esc_url( $custom_thumbnail ) . '" alt="' . get_the_title() . '" />';
} else {
if ( has_post_thumbnail() ) {
echo get_the_post_thumbnail( $post->ID, 'portfolio-thumb', array( 'title' => '' ) );
}
// no image added
else {
echo '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
}
}
?>
<div class="work-info-bg"></div>
<div class="work-info">
<div class="vert-center">
<?php
$featured_image = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full' );
$video_embed = get_post_meta( $post->ID, '_nectar_video_embed', true );
$video_m4v = get_post_meta( $post->ID, '_nectar_video_m4v', true );
$wp_version = floatval( get_bloginfo( 'version' ) );
$custom_project_link = get_post_meta( $post->ID, '_nectar_external_project_url', true );
$the_project_link = ( ! empty( $custom_project_link ) ) ? $custom_project_link : esc_url( get_permalink() );
// video
if ( ! empty( $video_embed ) || ! empty( $video_m4v ) ) {
echo nectar_portfolio_video_popup_link( $post, '1', $video_embed, $video_m4v );
}
// image
else {
echo '<a href="' . esc_url( $featured_image[0] ) . '" class="pp">' . esc_html__( 'View Larger', 'salient' ) . '</a> ';
}
echo '<a href="' . esc_url( $the_project_link ) . '">' . esc_html__( 'More Details', 'salient' ) . '</a>';
?>
</div><!--/vert-center-->
</div>
</div><!--work-item-->
<div class="work-meta">
<h4 class="title"><?php the_title(); ?></h4>
<?php
global $nectar_options;
if ( ! empty( $nectar_options['portfolio_date'] ) && $nectar_options['portfolio_date'] === '1' ) {
echo get_the_date();
}
?>
</div>
<div class="nectar-love-wrap">
<?php
if ( function_exists( 'nectar_love' ) ) {
nectar_love();}
?>
</div><!--/nectar-love-wrap-->
<div class="clear"></div>
</li><!--/span_4-->
<?php
endwhile;
endif;
?>
<?php if ( have_posts() ) { ?>
</ul><!--/carousel-->
</div><!--/carousel-wrap-->
<?php } ?>
<?php } //class exists ?>
<div class="divider-border"></div>
<?php
$posts_page_id = get_option( 'page_for_posts' );
$posts_page = get_page( $posts_page_id );
$posts_page_title = $posts_page->post_title;
$posts_page_link = get_page_uri( $posts_page_id );
$recent_posts_title_text = ( ! empty( $nectar_options['recent-posts-title'] ) ) ? $nectar_options['recent-posts-title'] : 'Recent Posts';
$recent_posts_link_text = ( ! empty( $nectar_options['recent-posts-link'] ) ) ? $nectar_options['recent-posts-link'] : 'View All Posts';
?>
<h2 class="uppercase recent-posts-title"><?php echo wp_kses_post( $recent_posts_title_text ); ?><a href="<?php echo esc_url( $posts_page_link ); ?>" class="button"> / <?php echo wp_kses_post( $recent_posts_link_text ); ?> </a></h2>
<div class="row blog-recent">
<?php
$recentBlogPosts = array(
'showposts' => 4,
'ignore_sticky_posts' => 1,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-link', 'post-format-quote' ),
'operator' => 'NOT IN',
),
),
);
query_posts( $recentBlogPosts );
if ( have_posts() ) :
while ( have_posts() ) :
the_post();
?>
<div class="col span_3">
<?php
$wp_version = floatval( get_bloginfo( 'version' ) );
if ( get_post_format() === 'video' ) {
if ( $wp_version < '3.6' ) {
$video_embed = get_post_meta( $post->ID, '_nectar_video_embed', true );
if ( ! empty( $video_embed ) ) {
echo '<div class="video-wrap">' . stripslashes( wp_specialchars_decode( $video_embed ) ) . '</div>';
}
} else {
$video_embed = get_post_meta( $post->ID, '_nectar_video_embed', true );
$video_m4v = get_post_meta( $post->ID, '_nectar_video_m4v', true );
$video_ogv = get_post_meta( $post->ID, '_nectar_video_ogv', true );
$video_poster = get_post_meta( $post->ID, '_nectar_video_poster', true );
if ( ! empty( $video_embed ) || ! empty( $video_m4v ) ) {
$wp_version = floatval( get_bloginfo( 'version' ) );
// video embed
if ( ! empty( $video_embed ) ) {
echo '<div class="video">' . do_shortcode( $video_embed ) . '</div>';
}
// self hosted video pre 3-6
elseif ( ! empty( $video_m4v ) && $wp_version < '3.6' ) {
echo '<div class="video">';
echo '</div>';
}
// self hosted video post 3-6
elseif ( $wp_version >= '3.6' ) {
if ( ! empty( $video_m4v ) || ! empty( $video_ogv ) ) {
$video_output = '[video ';
if ( ! empty( $video_m4v ) ) {
$video_output .= 'mp4="' . esc_url( $video_m4v ) . '" '; }
if ( ! empty( $video_ogv ) ) {
$video_output .= 'ogv="' . esc_url( $video_ogv ) . '"'; }
$video_output .= ' poster="' . esc_url( $video_poster ) . '"]';
echo '<div class="video">' . do_shortcode( $video_output ) . '</div>';
}
}
} // endif for if there's a video
} // endif for 3.6
} //endif for post format video
elseif ( get_post_format() === 'audio' ) {
?>
<div class="audio-wrap">
<?php
if ( $wp_version < '3.6' ) {
} else {
$audio_mp3 = get_post_meta( $post->ID, '_nectar_audio_mp3', true );
$audio_ogg = get_post_meta( $post->ID, '_nectar_audio_ogg', true );
if ( ! empty( $audio_ogg ) || ! empty( $audio_mp3 ) ) {
$audio_output = '[audio ';
if ( ! empty( $audio_mp3 ) ) {
$audio_output .= 'mp3="' . esc_url( $audio_mp3 ) . '" '; }
if ( ! empty( $audio_ogg ) ) {
$audio_output .= 'ogg="' . esc_url( $audio_ogg ) . '"'; }
$audio_output .= ']';
echo do_shortcode( $audio_output );
}
}
?>
</div><!--/audio-wrap-->
<?php
} elseif ( get_post_format() == 'gallery' ) {
if ( $wp_version < '3.6' ) {
if ( has_post_thumbnail() ) {
echo get_the_post_thumbnail( $post->ID, 'full', array( 'title' => '' ) ); }
} else {
$gallery_ids = nectar_grab_ids_from_gallery();
?>
<div class="flex-gallery">
<ul class="slides">
<?php
foreach ( $gallery_ids as $image_id ) {
echo '<li>' . wp_get_attachment_image( $image_id, '', false ) . '</li>';
}
?>
</ul>
</div><!--/gallery-->
<?php
}
} else {
if ( has_post_thumbnail() ) {
echo '<a href="' . esc_url( get_permalink() ) . '">' . get_the_post_thumbnail( $post->ID, 'blog', array( 'title' => '' ) ) . '</a>'; }
}
?>
<div class="post-header">
<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php the_author_posts_link(); ?> | <?php the_category( ', ' ); ?> | <a href="<?php comments_link(); ?>">
<?php comments_number( __( 'No Comments', 'salient' ), __( 'One Comment', 'salient' ), '% ' . __( 'Comments', 'salient' ) ); ?></a>
</div><!--/post-header-->
<?php the_excerpt(); ?>
</div><!--/span_3-->
<?php
endwhile;
endif;
?>
</div><!--/blog-recent-->
</div><!--/container-->
</div><!--/home-wrap-->
<?php get_footer(); ?>