-
Notifications
You must be signed in to change notification settings - Fork 1
/
template-home-4.php
116 lines (77 loc) · 4.46 KB
/
template-home-4.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
<?php
/*template name: Home - Slider Only */
get_header(); ?>
<?php $options = get_option('salient'); ?>
<div id="featured" data-caption-animation="<?php echo (!empty($options['slider-caption-animation']) && $options['slider-caption-animation'] == 1) ? '1' : '0'; ?>" data-bg-color="<?php if(!empty($options['slider-bg-color'])) echo $options['slider-bg-color']; ?>" data-slider-height="<?php if(!empty($options['slider-height'])) echo $options['slider-height']; ?>" data-animation-speed="<?php if(!empty($options['slider-animation-speed'])) echo $options['slider-animation-speed']; ?>" data-advance-speed="<?php if(!empty($options['slider-advance-speed'])) echo $options['slider-advance-speed']; ?>" data-autoplay="<?php echo $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)) { echo 'has-video'; } else { echo $alignment; } ?>">
<?php $image = get_post_meta($post->ID, '_nectar_slider_image', true); ?>
<article data-background-cover="<?php echo (!empty($options['slider-background-cover']) && $options['slider-background-cover'] == 1) ? '1' : '0'; ?>" style="background-image: url('<?php echo $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 pre 3-6
else if( !empty($video_m4v) && $wp_version < "3.6" || !empty($video_ogv) && $wp_version < "3.6") {
echo '<div class="video">';
nectar_video($post->ID);
echo '</div>';
}
//self hosted video post 3-6
else if($wp_version >= "3.6"){
if(!empty($video_m4v) || !empty($video_ogv)) {
$video_output = '[video ';
if(!empty($video_m4v)) { $video_output .= 'mp4="'. $video_m4v .'" '; }
if(!empty($video_ogv)) { $video_output .= 'ogv="'. $video_ogv .'"'; }
$video_output .= ' poster="'.$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">'.__("More Info",NECTAR_THEME_NAME).'</span><span class="btv">'.__("Back to Video",NECTAR_THEME_NAME).'</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 $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 $button_url; ?>" class="uppercase"><?php echo $button; ?></a>
<?php } ?>
</div><!--/post-title-->
</div>
</div>
</article>
</div>
<?php endwhile; ?>
<?php else: ?>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<div class="home-wrap">
<div class="container main-content">
<div class="row">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div><!--/row-->
</div><!--/container-->
</div><!--/home-wrap-->
<?php get_footer(); ?>