forked from Dravenrip/avada
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-slideshow-blog-shortcode.php
179 lines (166 loc) · 8.08 KB
/
new-slideshow-blog-shortcode.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
<?php global $smof_data; ?>
<?php global $post; ?>
<?php if($atts['layout'] != 'grid' && $atts['layout'] != 'timeline'): ?>
<style type="text/css">
<?php if(get_post_meta($post->ID, 'pyre_fimg_width', true) && get_post_meta($post->ID, 'pyre_fimg_width', true) != 'auto'): ?>
#post-<?php echo $post->ID; ?> .post-slideshow,
#post-<?php echo $post->ID; ?> .floated-post-slideshow
{max-width:<?php echo get_post_meta($post->ID, 'pyre_fimg_width', true); ?> !important;}
<?php endif; ?>
<?php if(get_post_meta($post->ID, 'pyre_fimg_height', true) && get_post_meta($post->ID, 'pyre_fimg_height', true) != 'auto'): ?>
#post-<?php echo $post->ID; ?> .post-slideshow,
#post-<?php echo $post->ID; ?> .floated-post-slideshow,
#post-<?php echo $post->ID; ?> .post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .post-slideshow .image > a > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > a > img
{height:<?php echo get_post_meta($post->ID, 'pyre_fimg_height', true); ?> !important;}
<?php endif; ?>
<?php if(get_post_meta($post->ID, 'pyre_fimg_width', true) && get_post_meta($post->ID, 'pyre_fimg_width', true) == 'auto'): ?>
#post-<?php echo $post->ID; ?> .post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .post-slideshow .image > a > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > a > img{
width:auto;
}
<?php endif; ?>
<?php if(get_post_meta($post->ID, 'pyre_fimg_height', true) && get_post_meta($post->ID, 'pyre_fimg_height', true) == 'auto'): ?>
#post-<?php echo $post->ID; ?> .post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .post-slideshow .image > a > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > a > img{
height:auto;
}
<?php endif; ?>
<?php
if(
get_post_meta($post->ID, 'pyre_fimg_height', true) && get_post_meta($post->ID, 'pyre_fimg_width', true) &&
get_post_meta($post->ID, 'pyre_fimg_height', true) != 'auto' && get_post_meta($post->ID, 'pyre_fimg_width', true) != 'auto'
) { ?>
@media only screen and (max-width: 479px){
#post-<?php echo $post->ID; ?> .post-slideshow,
#post-<?php echo $post->ID; ?> .floated-post-slideshow,
#post-<?php echo $post->ID; ?> .post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > img,
#post-<?php echo $post->ID; ?> .post-slideshow .image > a > img,
#post-<?php echo $post->ID; ?> .floated-post-slideshow .image > a > img{
width:auto !important;
height:auto !important;
}
}
<?php }
?>
</style>
<?php endif; ?>
<?php
if(get_post_meta($post->ID, 'pyre_image_rollover_icons', true) == 'link') {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:none;';
} elseif(get_post_meta($post->ID, 'pyre_image_rollover_icons', true) == 'zoom') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:inline-block;';
} elseif(get_post_meta($post->ID, 'pyre_image_rollover_icons', true) == 'no') {
$link_icon_css = 'display:none;';
$zoom_icon_css = 'display:none;';
} else {
$link_icon_css = 'display:inline-block;';
$zoom_icon_css = 'display:inline-block;';
}
$icon_url_check = get_post_meta(get_the_ID(), 'pyre_link_icon_url', true); if(!empty($icon_url_check)) {
$permalink = get_post_meta($post->ID, 'pyre_link_icon_url', true);
} else {
$permalink = get_permalink($post->ID);
}
?>
<?php
global $sidebar_exists;
if( ! $sidebar_exists || get_post_meta($post->ID, 'pyre_full_width', true) == 'yes' ) {
$size = 'full';
} else {
$size = 'blog-large';
}
if($atts['layout'] == 'medium' || $atts['layout'] == 'medium alternate') {
$size = 'blog-medium';
}
if(
get_post_meta($post->ID, 'pyre_fimg_height', true) && get_post_meta($post->ID, 'pyre_fimg_width', true) &&
get_post_meta($post->ID, 'pyre_fimg_height', true) != 'auto' && get_post_meta($post->ID, 'pyre_fimg_width', true) != 'auto'
) {
$size = 'full';
}
if(
get_post_meta($post->ID, 'pyre_fimg_height', true) == 'auto' ||get_post_meta($post->ID, 'pyre_fimg_width', true) == 'auto'
) {
$size = 'full';
}
if($atts['layout'] == 'grid' || $atts['layout'] == 'timeline') {
$size = 'full';
}
?>
<?php
if(has_post_thumbnail() ||
get_post_meta(get_the_ID(), 'pyre_video', true)
):
?>
<?php if($atts['layout'] == 'large' || $atts['layout'] == 'large alternate' || $atts['layout'] == 'grid' || $atts['layout'] == 'timeline'): ?>
<div class="fusion-flexslider flexslider post-slideshow">
<?php endif; ?>
<?php if($atts['layout'] == 'medium' || $atts['layout'] == 'medium alternate'): ?>
<div class="fusion-flexslider flexslider blog-medium-image floated-post-slideshow">
<?php endif; ?>
<ul class="slides">
<?php if(get_post_meta(get_the_ID(), 'pyre_video', true)): ?>
<li>
<div class="full-video">
<?php echo get_post_meta(get_the_ID(), 'pyre_video', true); ?>
</div>
</li>
<?php endif; ?>
<?php if(has_post_thumbnail()): ?>
<?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); ?>
<?php $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id()); ?>
<li>
<div class="image" aria-haspopup="true">
<?php if($smof_data['image_rollover']): ?>
<?php the_post_thumbnail($size); ?>
<?php else: ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail($size); ?></a>
<?php endif; ?>
<div class="image-extras">
<div class="image-extras-content">
<?php $full_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?>
<a style="<?php echo $link_icon_css; ?>" class="icon link-icon" href="<?php echo $permalink; ?>">Permalink</a>
<?php
if(get_post_meta($post->ID, 'pyre_video_url', true)) {
$full_image[0] = get_post_meta($post->ID, 'pyre_video_url', true);
}
?>
<a style="<?php echo $zoom_icon_css; ?>" class="icon gallery-icon" href="<?php echo $full_image[0]; ?>" data-rel="prettyPhoto[gallery<?php echo $post->ID; ?>]" title="<?php echo get_post_field('post_excerpt', get_post_thumbnail_id()); ?>"><?php if(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true)): ?><img style="display:none;" alt="<?php echo get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true); ?>" /><?php endif; ?>Gallery</a>
<h3><a href="<?php echo $permalink; ?>"><?php the_title(); ?></a></h3>
<h4><?php echo get_the_term_list($post->ID, 'category', '', ', ', ''); ?></h4>
</div>
</div>
</div>
</li>
<?php endif; ?>
<?php
$i = 2;
while($i <= $smof_data['posts_slideshow_number']):
$attachment_id = kd_mfi_get_featured_image_id('featured-image-'.$i, 'post');
if($attachment_id):
?>
<?php $attachment_image = wp_get_attachment_image_src($attachment_id, $size); ?>
<?php $full_image = wp_get_attachment_image_src($attachment_id, 'full'); ?>
<?php $attachment_data = wp_get_attachment_metadata($attachment_id); ?>
<?php if( is_array( $attachment_data ) ): ?>
<li>
<div class="image">
<a href="<?php the_permalink(); ?>"><img src="<?php echo $attachment_image[0]; ?>" alt="<?php echo $attachment_data['image_meta']['title']; ?>" /></a>
<a style="display:none;" href="<?php echo $full_image[0]; ?>" data-rel="prettyPhoto[gallery<?php echo $post->ID; ?>]" title="<?php echo get_post_field('post_excerpt', $attachment_id); ?>"><?php if(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)): ?><img style="display:none;" alt="<?php echo get_post_meta($attachment_id, '_wp_attachment_image_alt', true); ?>" /><?php endif; ?></a>
</div>
</li>
<?php endif; ?>
<?php endif; $i++; endwhile; ?>
</ul>
</div>
<?php endif; ?>