PluginProbe
WP Directory Kit / 1.5.7
WP Directory Kit v1.5.7
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
wpdirectorykit / elementor-elements / views / wdk-listing-slider-styles.php

wdk-listing-slider-styles.php in WP Directory Kit 1.5.7, at elementor-elements/views/wdk-listing-slider-styles.php

476 lines 20.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The template for Element Listing Images Slider.
4 * This is the template that elementor element slider, carousel
5 *
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11 ?>
12 <div class="wdk-element" id="wdk_el_<?php echo esc_html($id_element);?>">
13 <div class="wdk-listing-slider">
14 <?php if(count($images) > 0):?>
15 <?php if(!empty($images) && ($plans_exists || $images_fields || $images_fields)):?>
16 <div class="wdk-listing-slider--tabs">
17 <a data-filter="gallery" href="#" class="wdk-listing-slider--tabs--btn">
18 <?php echo esc_html__('Gallery', 'wpdirectorykit');?>
19 </a>
20
21 <?php if (!empty($plans_exists)): ?>
22 <a data-filter="plans" href="#" class="wdk-listing-slider--tabs--btn">
23 <?php echo esc_html__('Plans', 'wpdirectorykit');?>
24 </a>
25 <?php endif;?>
26 <?php if (!empty($images_fields)): ?>
27 <?php foreach ($images_fields as $field_id => $field_images): ?>
28 <a data-filter="<?php echo esc_attr($field_id); ?>" href="#" class="wdk-listing-slider--tabs--btn">
29 <?php echo esc_html(wdk_field_label($field_id)); ?>
30 </a>
31 <?php endforeach; ?>
32 <?php endif; ?>
33 </div>
34 <?php endif;?>
35
36 <div class="<?php if($settings['popup_enable'] == 'yes'):?> wdk_js_gallery <?php endif;?> wdk_listing_slider_box <?php echo esc_attr($settings['layout_carousel_animation_style']).'_animation';?> <?php echo esc_attr(join(' ', [$settings['styles_carousel_dots_position_style'], $settings['styles_carousel_arrows_position_style'],$settings['styles_carousel_arrows_position'],$settings['styles_carousel_arrows_position_style']]));?>">
37 <div class="wdk_listing_slider_ini wdk-listing-slider-styles">
38 <?php foreach($images as $key => $image):?>
39 <?php
40 $type = 'gallery';
41 if(strpos( $key,'__') !== FALSE){
42 $type = substr($key, 0, strpos($key, '__'));
43 }
44 ?>
45
46 <div class="wdk-col">
47 <div class="wdk-listing-image-card">
48 <?php if (
49 is_string($image) && (
50 filter_var($image, FILTER_VALIDATE_URL) ||
51 preg_match('/^www\./i', $image)
52 )
53 ): ?>
54
55
56
57 <?php if (strpos($image, 'vimeo.com') !== FALSE):?>
58 <div
59 data-type="<?php echo esc_attr($type);?>"
60 class="wdk-listing-image wdk-listing-video-embed<?php if($settings['enable_fixed_height']!='yes'):?> auto_height<?php endif;?>"
61 >
62 <?php echo wp_oembed_get($image, array("width" => "800", "height" => "450"));?>
63 </div>
64 <?php elseif (strpos($image, 'watch?v=') !== FALSE):?>
65 <?php $embed_code = substr($image, strpos($image, 'watch?v=') + 8); ?>
66 <div
67 data-type="<?php echo esc_attr($type);?>"
68 class="wdk-listing-image wdk-listing-video-embed<?php if($settings['enable_fixed_height']!='yes'):?> auto_height<?php endif;?>"
69 >
70 <?php echo wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));?>
71 </div>
72 <?php elseif (strpos($image, 'youtube.com/shorts/') !== FALSE):?>
73 <?php $embed_code = substr($image, strpos($image, 'shorts') + 7); ?>
74 <div
75 data-type="<?php echo esc_attr($type);?>"
76 class="wdk-listing-image wdk-listing-video-embed<?php if($settings['enable_fixed_height']!='yes'):?> auto_height<?php endif;?>"
77 >
78 <?php echo wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));?>
79 </div>
80 <?php elseif (strpos($image, 'youtu.be/') !== FALSE):?>
81 <?php $embed_code = substr($image, strpos($image, 'youtu.be/') + 9); ?>
82 <div
83 data-type="<?php echo esc_attr($type);?>"
84 class="wdk-listing-image wdk-listing-video-embed<?php if($settings['enable_fixed_height']!='yes'):?> auto_height<?php endif;?>"
85 >
86 <?php echo wp_oembed_get('https://www.youtube.com/watch?v=' . $embed_code, array("width" => "800", "height" => "455"));?>
87 </div>
88 <?php elseif (filter_var($image, FILTER_VALIDATE_URL) !== FALSE && preg_match('/\.(mp4|flv|wmw|ogv|webm|ogg)$/i', $image)):?>
89 <video
90 src="<?php echo esc_url($image);?>"
91 controls
92 data-type="<?php echo esc_attr($type);?>"
93 class="wdk-listing-image<?php if($settings['enable_fixed_height']!='yes'):?> auto_height<?php endif;?>"
94 ></video>
95
96 <?php else:?>
97 <iframe
98 data-type="<?php echo esc_attr($type);?>"
99 src="<?php echo esc_url($image);?>" width="100%" frameborder="0" allowfullscreen
100 class="wdk-listing-image <?php if($settings['enable_fixed_height']!='yes'):?> auto_height <?php endif;?>"
101 ></iframe>
102 <?php endif;?>
103 <?php elseif(!wmvc_show_data('wdk_listing_video_disabled',$settings, false) && wdk_file_extension_type(wmvc_show_data('src',$image)) == 'video'):?>
104 <video data-type="<?php echo esc_attr($type);?>" controls src="<?php echo esc_url(wmvc_show_data('src',$image));?>" alt="<?php echo esc_attr(wmvc_show_data('alt',$image));?>" class="wdk-listing-image <?php if($settings['enable_fixed_height']!='yes'):?> auto_height <?php endif;?>"></video>
105 <?php elseif(wdk_file_extension_type(wmvc_show_data('src',$image)) == 'image'):?>
106 <img
107 data-type="<?php echo esc_attr($type);?>"
108 src="<?php echo esc_url(wmvc_show_data('src',$image));?>"
109 class="wdk-listing-image<?php if($settings['enable_fixed_height'] != 'yes'):?> auto_height<?php endif;?>"
110 alt="<?php echo esc_attr(wmvc_show_data('alt',$image));?>"
111 >
112
113 <?php endif;?>
114 </div>
115 </div>
116 <?php endforeach;?>
117
118 <?php if(!empty($images) && wmvc_show_data('layout_carousel_columns', $settings,1) < wmvc_count($images)):?>
119 </div>
120 <div class="wdk-listing-slider_arrows">
121 <a title="<?php echo esc_attr__('prev slider', 'wpdirectorykit');?>" href="#" class="wdk-slider-prev wdk-listing-slider_arrow">
122 <?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_arrows_icon_left'], [ 'aria-hidden' => 'true' ] ); ?>
123 </a>
124 <a title="<?php echo esc_attr__('prev slider', 'wpdirectorykit');?>" href="#" class="wdk-slider-next wdk-listing-slider_arrow">
125 <?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_arrows_icon_right'], [ 'aria-hidden' => 'true' ] ); ?>
126 </a>
127 </div>
128 </div>
129 <?php else:?>
130 </div>
131 </div>
132 <?php endif;?>
133 <?php endif;?>
134
135 <?php if(count($images) > 1): ?>
136 <div class="banner-thumbs-con elementor-section elementor-section-boxed">
137 <div class="elementor-container">
138 <div class="banner-thumbs">
139 <?php foreach($images as $key => $image):?>
140 <?php
141 $type = 'gallery';
142 if(strpos( $key,'__') !== FALSE){
143 $type = substr($key, 0, strpos($key, '__'));
144 }
145 ?>
146
147 <?php if (
148 is_string($image) && (
149 filter_var($image, FILTER_VALIDATE_URL) ||
150 preg_match('/^www\./i', $image)
151 )
152 ): ?>
153
154 <?php elseif(!wmvc_show_data('wdk_listing_video_disabled',$settings, false) && wdk_file_extension_type(wmvc_show_data('src',$image)) == 'video'):?>
155 <div class="banner-thumb">
156 <video data-type="<?php echo esc_attr($type);?>" src="<?php echo esc_url(wmvc_show_data('src',$image));?>" alt="<?php echo esc_attr(wmvc_show_data('alt',$image));?>" class="wdk-listing-image <?php if($settings['enable_fixed_height']!='yes'):?> auto_height <?php endif;?>"></video>
157 </div>
158 <?php elseif(wdk_file_extension_type(wmvc_show_data('src',$image)) == 'image'):?>
159 <div class="banner-thumb">
160 <img data-type="<?php echo esc_attr($type);?>" src="<?php echo esc_url(wmvc_show_data('src',$image));?>" class="wdk-listing-image <?php if($settings['enable_fixed_height']!='yes'):?> auto_height <?php endif;?>" alt="<?php echo esc_attr(wmvc_show_data('alt',$image));?>">
161 </div>
162 <?php endif;?>
163 <?php endforeach;?>
164 </div><!--banner-thumbs end-->
165 </div>
166 </div>
167 <?php endif;?>
168 </div>
169 <script>
170 jQuery(document).ready(function($){
171 var sliderSelector = '#wdk_el_<?php echo esc_html($id_element);?> .wdk_listing_slider_ini';
172 var thumbsSelector = '#wdk_el_<?php echo esc_html($id_element);?> .banner-thumbs';
173
174 // Initialize main slider and thumbs
175 var $slider = $(sliderSelector).slick({
176 <?php if(!empty($images) && wmvc_show_data('layout_carousel_columns', $settings,1) < wmvc_count($images)):?>
177 dots: true,
178 arrows: true,
179 <?php else:?>
180 dots: false,
181 arrows: false,
182 <?php endif;?>
183 slidesToShow: <?php echo wmvc_show_data('layout_carousel_columns', $settings, 1);?>,
184 slidesToScroll: <?php echo wmvc_show_data('layout_carousel_columns', $settings,1);?>,
185 <?php if(!empty(wmvc_show_data('layout_carousel_is_infinite', $settings))):?>
186 infinite: <?php echo wmvc_show_data('layout_carousel_is_infinite', $settings, 'true');?>,
187 <?php endif;?>
188 <?php if(!empty(wmvc_show_data('layout_carousel_is_autoplay', $settings))):?>
189 autoplay: <?php echo wmvc_show_data('layout_carousel_is_autoplay', $settings, 'false');?>,
190 <?php endif;?>
191 nextArrow: $('#wdk_el_<?php echo esc_html($id_element);?> .wdk-listing-slider_arrows .wdk-slider-next'),
192 prevArrow: $('#wdk_el_<?php echo esc_html($id_element);?> .wdk-listing-slider_arrows .wdk-slider-prev'),
193 customPaging: function(slider, i) {
194 return '<span class="wdk_lr_dot"><?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_dots_icon'], [ 'aria-hidden' => 'true' ] ); ?></span>';
195 },
196 responsive: [
197 {
198 breakpoint: 600,
199 settings: {
200 slidesToShow: 1,
201 slidesToScroll: 1
202 }
203 },
204 ],
205 asNavFor: thumbsSelector,
206 });
207
208 var $thumbs = $(thumbsSelector).slick({
209 slidesToShow: <?php echo (!empty(trim(wmvc_show_data('styles_thmbn_nav_columns', $settings, '4')))) ? wmvc_show_data('styles_thmbn_nav_columns', $settings, '4') : 4;?>,
210 slidesToScroll: 1,
211 asNavFor: sliderSelector,
212 dots: false,
213 centerMode: false,
214 arrows: false,
215 focusOnSelect: true,
216 responsive: [
217 {
218 breakpoint: 991,
219 settings: {
220 slidesToShow: <?php echo (!empty(trim(wmvc_show_data('styles_thmbn_nav_columns_tablet', $settings, '3')))) ? wmvc_show_data('styles_thmbn_nav_columns_tablet', $settings, '3') : 3;?>,
221 }
222 },
223 {
224 breakpoint: 768,
225 settings: {
226 slidesToShow: <?php echo (!empty(trim(wmvc_show_data('styles_thmbn_nav_columns_mobile', $settings, '2')))) ? wmvc_show_data('styles_thmbn_nav_columns_mobile', $settings, '2') : 2;?>,
227 }
228 },
229 ]
230 });
231
232 // Filtering Functionality based on data-filter attribute
233 // Add or remove .active on buttons. On second click (if already active), unselect and show all.
234 $(document).on('click', '[data-filter]', function(e){
235 e.preventDefault();
236 var $btn = $(this);
237 var filterType = $btn.data('filter');
238 var isActive = $btn.hasClass('active');
239
240 // Remove all active classes from buttons
241 $('[data-filter]').removeClass('active');
242
243 if (isActive) {
244 // If already active and clicked again, unselect and show all slides
245 // Unfilter (show all)
246 $slider.slick('slickUnfilter');
247 $thumbs.slick('slickUnfilter');
248 } else {
249 // Make this button active
250 $btn.addClass('active');
251 if (filterType === 'all') {
252 // Show all slides
253 $slider.slick('slickUnfilter');
254 $thumbs.slick('slickUnfilter');
255 } else {
256 // Filter slides and thumbs
257 $slider.slick('slickUnfilter');
258 $thumbs.slick('slickUnfilter');
259 $slider.slick('slickFilter', function(){
260 var $img = $(this).find('.wdk-listing-image');
261 return $img.data('type') === filterType;
262 });
263 $thumbs.slick('slickFilter', function() {
264 var $img = $(this).find('.wdk-listing-image,video,iframe');
265 return $img.data('type') === filterType;
266 });
267 }
268 }
269 });
270
271 })
272 </script>
273 </div>
274
275
276 <style>
277 .wdk-listing-slider-styles .caption, .wdk-listing-slider-styles .slick-slide::before, .wdk-listing-slider-styles .slick-slide {
278 -webkit-backface-visibility: hidden;
279 backface-visibility: hidden;
280 }
281
282 .wdk-listing-slider-styles .slick-slide::before {
283 content: '';
284 position: absolute;
285 top: 0;
286 left: 0;
287 width: 100%;
288 height: 100%;
289 }
290
291 .wdk-listing-slider-styles {
292 position: relative;
293 width: 100%;
294 height: 38vw;
295 min-height: 8vw;
296 margin-bottom: 50px;
297 opacity: 0;
298 visibility: hidden;
299 transition: all 1.2s ease;
300 }
301
302 .wdk-listing-slider-styles.slick-initialized {
303 opacity: 1;
304 visibility: visible;
305 }
306
307 .wdk-listing-slider-styles .slick-slide {
308 position: relative;
309 height: 38vw;
310 }
311
312 .wdk-listing-slider-styles .slick-slide::before {
313 background-color: #000;
314 opacity: .3;
315 z-index: 1;
316 }
317
318 .wdk-listing-slider-styles .slick-slide video {
319 display: block;
320 position: absolute;
321 top: 50%;
322 left: 50%;
323 min-width: 100%;
324 min-height: 100%;
325 width: auto;
326 height: auto;
327 transform: translate(-50%, -50%);
328 }
329
330 .wdk-listing-slider-styles .slick-slide iframe {
331 position: relative;
332 pointer-events: none;
333 }
334
335 .wdk-listing-slider-styles .slick-slide figure {
336 position: relative;
337 height: 100%;
338 }
339
340 .wdk-listing-slider-styles .slick-slide .slide-image {
341 opacity: 0;
342 height: 100%;
343 background-size: cover;
344 background-position: center;
345 transition: all .8s ease;
346 }
347
348 .wdk-listing-slider-styles .slick-slide .slide-image.show {
349 opacity: 1;
350 }
351
352 .wdk-listing-slider-styles .slick-slide .image-entity {
353 width: 100%;
354 opacity: 0;
355 visibility: hidden;
356 }
357
358 .wdk-listing-slider-styles .slick-slide .loading {
359 position: absolute;
360 top: 44%;
361 left: 0;
362 width: 100%;
363 }
364
365 .wdk-listing-slider-styles .slick-slide .slide-media {
366 animation: slideOut 0.4s cubic-bezier(0.4, 0.29, 0.01, 1);
367 }
368
369 .wdk-listing-slider-styles .slick-slide.slick-active {
370 z-index: 1;
371 }
372
373 .wdk-listing-slider-styles .slick-slide.slick-active .slide-media {
374 animation: slideIn 2.4s cubic-bezier(0.4, 0.29, 0.01, 1);
375 }
376
377 .wdk-listing-slider-styles .slick-slide.slick-active .caption {
378 opacity: 1;
379 transform: translateY(0);
380 transition: all 0.7s cubic-bezier(0.32, 0.34, 0, 1.62) 0.6s;
381 }
382
383 .wdk-listing-slider-styles .caption {
384 position: absolute;
385 top: 44%;
386 left: 5%;
387 text-align: center;
388 padding: 20px;
389 border: 3px solid;
390 color: #fff;
391 margin: 0;
392 font-size: 40px;
393 font-weight: bold;
394 letter-spacing: .02em;
395 opacity: 0;
396 z-index: 1;
397 transition: all .3s ease;
398 transform: translateY(100px);
399 }
400
401 .wdk-listing-slider-styles .slick-dots {
402 text-align: center;
403 padding-top: 15px;
404 }
405
406 .wdk-listing-slider-styles .slick-dots li {
407 display: inline-block;
408 vertical-align: top;
409 margin: 0 8px;
410 }
411
412 .wdk-listing-slider-styles .slick-dots li button {
413 width: 16px;
414 height: 16px;
415 border: none;
416 cursor: pointer;
417 border-radius: 50%;
418 border: 2px solid #fff;
419 box-shadow: 0 0 0 0 transparent;
420 vertical-align: middle;
421 color: #fff;
422 background-color: #fff;
423 transition: all .3s ease;
424 opacity: .4;
425 }
426
427 .wdk-listing-slider-styles .slick-dots li button:focus {
428 outline: none;
429 }
430
431 .wdk-listing-slider-styles .slick-dots li button:hover {
432 opacity: 1;
433 }
434
435 .wdk-listing-slider-styles .slick-dots li.slick-active button {
436 border-color: #2d3042;
437 box-shadow: 0 0 0 2px #fff;
438 opacity: 1;
439 }
440
441 .wdk-listing-slider-styles .container {
442 background-color: #f2f2f2;
443 color: #444;
444 line-height: 1.6;
445 padding: 40px 0;
446 }
447
448 .wdk-listing-slider-styles .container .content {
449 width: 90%;
450 max-width: 980px;
451 margin: 0 auto;
452 }
453
454 .wdk-listing-slider-styles .container p {
455 margin-bottom: 40px;
456 }
457
458 @keyframes slideIn {
459 from {
460 filter: blur(15px);
461 }
462 to {
463 filter: blur(0);
464 }
465 }
466
467 @keyframes slideOut {
468 from {
469 filter: blur(0);
470 }
471 to {
472 filter: blur(15px);
473 }
474 }
475
476 </style>