-
Notifications
You must be signed in to change notification settings - Fork 0
/
meteor-slideshow.php
166 lines (92 loc) · 4.69 KB
/
meteor-slideshow.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
<?php
/* Loop template for the Meteor Slides 1.5.4 slideshow
Copy "meteor-slideshow.php" from "/meteor-slides/" to your theme's directory to replace
the plugin's default slideshow loop.
Learn more about customizing the slideshow template for Meteor Slides:
http://www.jleuze.com/plugins/meteor-slides/customizing-the-slideshow-template/
*/
// Settings for slideshow loop
global $post;
$meteor_posttemp = $post;
$meteor_options = get_option( 'meteorslides_options' );
$meteor_nav = $meteor_options['slideshow_navigation'];
$meteor_count = 1;
$meteor_loop = new WP_Query( array(
'post_type' => 'slide',
'slideshow' => $slideshow,
'posts_per_page' => $meteor_options['slideshow_quantity'],
'orderby' => 'menu_order',
'order' => 'ASC'
) ); ?>
<?php // Check for slides
if ( $meteor_loop->have_posts() ) : ?>
<div id="meteor-slideshow<?php echo $slideshow; ?>" class="meteor-slides <?php
// Adds classes to slideshow
echo $slideshow . ' ' . $meteor_nav;
if ( $meteor_loop->post_count == 1 ) {
echo ' single-slide';
}
// Adds metadata to slideshow
if ( !empty( $metadata ) || !empty( $slideshow ) ) {
echo ' { ';
}
if ( !empty( $slideshow ) ) {
echo "next: '#meteor-next" . $slideshow . "', prev: '#meteor-prev" . $slideshow . "', pager: '#meteor-buttons" . $slideshow . "'";
}
if ( !empty( $metadata ) && !empty( $slideshow ) ) {
echo ', ';
}
echo $metadata;
if ( !empty( $metadata ) || !empty( $slideshow ) ) {
echo ' }';
}
?>">
<?php // Check for multiple slides
if ( $meteor_loop->post_count > 1 ) : ?>
<?php // Adds Previous/Next and Paged navigation
if ( $meteor_nav == "navboth" ) : ?>
<ul class="meteor-nav">
<li id="meteor-prev<?php echo $slideshow; ?>" class="prev"><a href="#prev"><?php _e( 'Previous', 'meteor-slides' ) ?></a></li>
<li id="meteor-next<?php echo $slideshow; ?>" class="next"><a href="#next"><?php _e( 'Next', 'meteor-slides' ) ?></a></li>
</ul><!-- .meteor-nav -->
<div id="meteor-buttons<?php echo $slideshow; ?>" class="meteor-buttons"></div>
<?php // Adds Previous/Next navigation
elseif ( $meteor_nav == "navprevnext" ) : ?>
<ul class="meteor-nav">
<li id="meteor-prev<?php echo $slideshow; ?>" class="prev"><a href="#prev"><?php _e( 'Previous', 'meteor-slides' ) ?></a></li>
<li id="meteor-next<?php echo $slideshow; ?>" class="next"><a href="#next"><?php _e( 'Next', 'meteor-slides' ) ?></a></li>
</ul><!-- .meteor-nav -->
<?php // Adds Paged navigation
elseif ( $meteor_nav == "navpaged" ): ?>
<div id="meteor-buttons<?php echo $slideshow; ?>" class="meteor-buttons"></div>
<?php endif; ?>
<?php endif; ?>
<div class="meteor-clip">
<?php // Loop which loads the slideshow
while ( $meteor_loop->have_posts() ) : $meteor_loop->the_post(); ?>
<?php // Use first slide image as shim to scale slideshow
// if ( $meteor_count == 1 ) {
if ( $meteor_count == 1 && $meteor_loop->post_count > 1 ) {
$meteor_shim = wp_get_attachment_image_src( get_post_thumbnail_id(), 'featured-slide');
echo '<img style="visibility: hidden;" class="meteor-shim" src="' . $meteor_shim[0] . '" alt="" />';
} ?>
<div aria-label="slide <?php echo $meteor_count; ?>" class="mslide mslide-<?php echo $meteor_count; ?>">
<?php // Adds slide image with Slide URL link
if ( get_post_meta( $post->ID, "slide_url_value", $single = true ) != "" ): ?>
<a href="<?php echo get_post_meta( $post->ID, "slide_url_value", $single = true ); ?>"><?php the_post_thumbnail( 'featured-slide'); ?></a>
<?php // Adds slide image without Slide URL link
else: ?>
<?php the_post_thumbnail( 'featured-slide'); ?>
<div class="ss-overlay">
<img src="<? bloginfo('template_url'); ?>/images/slideshow-overlay.png" />
</div>
<?php endif; ?>
</div><!-- .mslide -->
<?php $meteor_count++; ?>
<?php endwhile; ?>
</div><!-- .meteor-clip -->
<?php // Reset the slideshow loop
$post = $meteor_posttemp;
wp_reset_postdata(); ?>
</div><!-- .meteor-slides -->
<?php endif; ?>