PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
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.9, at elementor-elements/views/wdk-listing-slider-styles.php

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