PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.3
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.3
4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 All 147 releases
ultimate-post-kit / modules / snog-slider / widgets / snog-slider.php

snog-slider.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.5.3, at modules/snog-slider/widgets/snog-slider.php

1,630 lines 41.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\SnogSlider\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Border;
7 use Elementor\Group_Control_Box_Shadow;
8 use Elementor\Group_Control_Typography;
9 use Elementor\Group_Control_Text_Shadow;
10 use Elementor\Group_Control_Text_Stroke;
11 use Elementor\Group_Control_Image_Size;
12 use Elementor\Group_Control_Background;
13 use Elementor\Plugin;
14
15 use UltimatePostKit\Utils;
16 use UltimatePostKit\Traits\Global_Widget_Controls;
17 use UltimatePostKit\Traits\Global_Widget_Functions;
18 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
19 use UltimatePostKit\Modules\QueryControl\Controls\Group_Control_Posts;
20 use WP_Query;
21
22 if (!defined('ABSPATH')) exit; // Exit if accessed directly
23
24 class Snog_Slider extends Group_Control_Query {
25
26 use Global_Widget_Controls;
27 use Global_Widget_Functions;
28
29 private $_query = null;
30
31 public function get_name() {
32 return 'upk-snog-slider';
33 }
34
35 public function get_title() {
36 return BDTUPK . esc_html__('Snog Slider', 'ultimate-post-kit');
37 }
38
39 public function get_icon() {
40 return 'upk-widget-icon upk-icon-snog-slider';
41 }
42
43 public function get_categories() {
44 return ['ultimate-post-kit'];
45 }
46
47 public function get_keywords() {
48 return ['post', 'carousel', 'blog', 'recent', 'news', 'slider', 'snog'];
49 }
50
51 public function get_style_depends() {
52 if ($this->upk_is_edit_mode()) {
53 return ['swiper', 'upk-all-styles'];
54 } else {
55 return ['swiper', 'upk-font', 'upk-snog-slider'];
56 }
57 }
58
59 public function get_script_depends() {
60 if ($this->upk_is_edit_mode()) {
61 return ['swiper', 'upk-all-scripts'];
62 } else {
63 return ['swiper', 'upk-snog-slider'];
64 }
65 }
66
67 public function get_custom_help_url() {
68 return 'https://youtu.be/UKZIEgYg0gs?si=exkIDYa-j2c7E34t';
69 }
70
71
72 public function get_query() {
73 return $this->_query;
74 }
75
76 public function has_widget_inner_wrapper(): bool {
77 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
78 }
79
80
81 protected function register_controls() {
82 $this->start_controls_section(
83 'section_content_layout',
84 [
85 'label' => esc_html__('Layout', 'ultimate-post-kit'),
86 ]
87 );
88
89 $this->add_responsive_control(
90 'item_height',
91 [
92 'label' => esc_html__('Height', 'ultimate-post-kit'),
93 'type' => Controls_Manager::SLIDER,
94 'size_units' => [ 'px', '%', 'vh' ],
95 'range' => [
96 'px' => [
97 'min' => 200,
98 'max' => 1080,
99 ],
100 '%' => [
101 'min' => 10,
102 'max' => 100,
103 ],
104 'vh' => [
105 'min' => 10,
106 'max' => 100,
107 ],
108 ],
109 'selectors' => [
110 '{{WRAPPER}} .upk-snog-slider-wrap .upk-main-slider, {{WRAPPER}} .upk-snog-slider-wrap .upk-snog-thumbs' => 'height: {{SIZE}}{{UNIT}};',
111 ],
112 ]
113 );
114
115 $this->add_responsive_control(
116 'content_width',
117 [
118 'label' => esc_html__('Content Width', 'ultimate-post-kit'),
119 'type' => Controls_Manager::SLIDER,
120 'size_units' => [ 'px', '%' ],
121 'range' => [
122 'px' => [
123 'min' => 200,
124 'max' => 1200,
125 ],
126 '%' => [
127 'min' => 10,
128 'max' => 100,
129 ],
130 ],
131 'selectors' => [
132 '{{WRAPPER}} .upk-snog-slider-wrap .upk-content-slider' => 'width: {{SIZE}}{{UNIT}}; min-width: {{SIZE}}{{UNIT}};',
133 ],
134 ]
135 );
136
137 $this->add_responsive_control(
138 'content_alignment',
139 [
140 'label' => __( 'Alignment', 'ultimate-post-kit' ),
141 'type' => Controls_Manager::CHOOSE,
142 'options' => [
143 'left' => [
144 'title' => __( 'Left', 'ultimate-post-kit' ),
145 'icon' => 'eicon-h-align-left',
146 ],
147 'center' => [
148 'title' => __( 'Center', 'ultimate-post-kit' ),
149 'icon' => 'eicon-h-align-center',
150 ],
151 'right' => [
152 'title' => __( 'Right', 'ultimate-post-kit' ),
153 'icon' => 'eicon-h-align-right',
154 ],
155 ],
156 'selectors' => [
157 '{{WRAPPER}} .upk-snog-slider-wrap .upk-content-wrap' => 'text-align: {{VALUE}};',
158 ],
159 ]
160 );
161
162 $this->add_group_control(
163 Group_Control_Image_Size::get_type(),
164 [
165 'name' => 'primary_thumbnail',
166 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
167 'exclude' => ['custom'],
168 'default' => 'full',
169 ]
170 );
171
172 $this->add_control(
173 'hr_1',
174 [
175 'type' => Controls_Manager::DIVIDER,
176 ]
177 );
178
179 //Global Title Controls
180 $this->register_title_controls();
181
182 $this->add_control(
183 'show_category',
184 [
185 'label' => esc_html__('Show Category', 'ultimate-post-kit'),
186 'type' => Controls_Manager::SWITCHER,
187 'default' => 'yes',
188 ]
189 );
190
191 $this->add_control(
192 'show_excerpt',
193 [
194 'label' => esc_html__( 'Show Text', 'ultimate-post-kit' ),
195 'type' => Controls_Manager::SWITCHER,
196 // 'default' => 'yes',
197 ]
198 );
199
200 $this->add_control(
201 'excerpt_length',
202 [
203 'label' => esc_html__( 'Text Limit', 'ultimate-post-kit' ),
204 'description' => esc_html__( 'It\'s just work for main content, but not working with excerpt. If you set 0 so you will get full main content.', 'ultimate-post-kit' ),
205 'type' => Controls_Manager::NUMBER,
206 'default' => 15,
207 'condition' => [
208 'show_excerpt' => 'yes'
209 ],
210 ]
211 );
212
213 $this->add_control(
214 'strip_shortcode',
215 [
216 'label' => esc_html__( 'Strip Shortcode', 'ultimate-post-kit' ),
217 'type' => Controls_Manager::SWITCHER,
218 'default' => 'yes',
219 'condition' => [
220 'show_excerpt' => 'yes',
221 ],
222 ]
223 );
224
225 $this->add_control(
226 'show_author',
227 [
228 'label' => esc_html__( 'Show Author', 'ultimate-post-kit' ),
229 'type' => Controls_Manager::SWITCHER,
230 'default' => 'yes',
231 'separator' => 'before'
232 ]
233 );
234
235 $this->add_control(
236 'meta_separator',
237 [
238 'label' => __( 'Separator', 'ultimate-post-kit' ),
239 'type' => Controls_Manager::TEXT,
240 'default' => '//',
241 'label_block' => false,
242 ]
243 );
244
245 $this->add_control(
246 'show_readmore',
247 [
248 'label' => esc_html__('Show Read More', 'ultimate-post-kit'),
249 'type' => Controls_Manager::SWITCHER,
250 'default' => 'yes',
251 'separator' => 'before'
252 ]
253 );
254
255 $this->add_control(
256 'readmore_text',
257 [
258 'label' => __( 'Read More Text', 'ultimate-post-kit' ),
259 'type' => Controls_Manager::TEXT,
260 'dynamic' => [ 'active' => true ],
261 'default' => esc_html__('Explore', 'ultimate-post-kit'),
262 'label_block' => false,
263 'condition' => [
264 'show_readmore' => 'yes'
265 ]
266 ]
267 );
268
269 //Global Date Controls
270 $this->register_date_controls();
271
272 //Global Reading Time Controls
273 $this->register_reading_time_controls();
274
275 $this->add_control(
276 'show_navigation',
277 [
278 'label' => esc_html__('Show Navigation Arrows', 'ultimate-post-kit'),
279 'type' => Controls_Manager::SWITCHER,
280 'default' => 'yes',
281 'separator' => 'before'
282 ]
283 );
284
285 $this->add_control(
286 'show_pagination',
287 [
288 'label' => esc_html__('Show Pagination', 'ultimate-post-kit'),
289 'type' => Controls_Manager::SWITCHER,
290 'default' => 'yes',
291 ]
292 );
293
294
295 $this->end_controls_section();
296
297 // Query Settings
298 $this->start_controls_section(
299 'section_post_query_builder',
300 [
301 'label' => __( 'Query', 'ultimate-post-kit' ),
302 'tab' => Controls_Manager::TAB_CONTENT,
303 ]
304 );
305
306 $this->add_control(
307 'item_limit',
308 [
309 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
310 'type' => Controls_Manager::SLIDER,
311 'range' => [
312 'px' => [
313 'min' => 1,
314 'max' => 20,
315 ],
316 ],
317 'default' => [
318 'size' => 5,
319 ],
320 'condition' => [
321 'posts_source!' => 'current_query',
322 ]
323 ]
324 );
325
326 $this->register_query_builder_controls();
327
328 $this->end_controls_section();
329
330 $this->start_controls_section(
331 'section_carousel_settings',
332 [
333 'label' => __( 'Slider Settings', 'ultimate-post-kit' ),
334 ]
335 );
336
337 $this->add_control(
338 'autoplay',
339 [
340 'label' => __( 'Autoplay', 'ultimate-post-kit' ),
341 'type' => Controls_Manager::SWITCHER,
342 'default' => 'yes',
343
344 ]
345 );
346
347 $this->add_control(
348 'autoplay_speed',
349 [
350 'label' => esc_html__( 'Autoplay Speed', 'ultimate-post-kit' ),
351 'type' => Controls_Manager::NUMBER,
352 'default' => 5000,
353 'condition' => [
354 'autoplay' => 'yes',
355 ],
356 ]
357 );
358
359 $this->add_control(
360 'pauseonhover',
361 [
362 'label' => esc_html__( 'Pause on Hover', 'ultimate-post-kit' ),
363 'type' => Controls_Manager::SWITCHER,
364 'condition' => [
365 'autoplay' => 'yes',
366 ],
367 ]
368 );
369
370 $this->add_control(
371 'grab_cursor',
372 [
373 'label' => __( 'Grab Cursor', 'ultimate-post-kit' ),
374 'type' => Controls_Manager::SWITCHER,
375 ]
376 );
377
378 $this->add_control(
379 'loop',
380 [
381 'label' => __( 'Loop', 'ultimate-post-kit' ),
382 'type' => Controls_Manager::SWITCHER,
383 'default' => 'yes',
384
385 ]
386 );
387
388
389 $this->add_control(
390 'speed',
391 [
392 'label' => __( 'Animation Speed (ms)', 'ultimate-post-kit' ),
393 'type' => Controls_Manager::SLIDER,
394 'default' => [
395 'size' => 800,
396 ],
397 'range' => [
398 'px' => [
399 'min' => 100,
400 'max' => 5000,
401 'step' => 50,
402 ],
403 ],
404 ]
405 );
406
407 $this->add_control(
408 'observer',
409 [
410 'label' => __( 'Observer', 'ultimate-post-kit' ),
411 'description' => __( 'When you use carousel in any hidden place (in tabs, accordion etc) keep it yes.', 'ultimate-post-kit' ),
412 'type' => Controls_Manager::SWITCHER,
413 ]
414 );
415
416 $this->end_controls_section();
417
418 //Style
419 $this->start_controls_section(
420 'section_style_content',
421 [
422 'label' => esc_html__('Items', 'ultimate-post-kit'),
423 'tab' => Controls_Manager::TAB_STYLE,
424 ]
425 );
426
427 $this->add_control(
428 'overlay_type',
429 [
430 'label' => esc_html__('Overlay', 'ultimate-post-kit'),
431 'type' => Controls_Manager::SELECT,
432 'default' => 'background',
433 'options' => [
434 'none' => esc_html__('None', 'ultimate-post-kit'),
435 'background' => esc_html__('Background', 'ultimate-post-kit'),
436 'blend' => esc_html__('Blend', 'ultimate-post-kit'),
437 ],
438 ]
439 );
440
441 $this->add_control(
442 'overlay_color',
443 [
444 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
445 'type' => Controls_Manager::COLOR,
446 'selectors' => [
447 '{{WRAPPER}} .upk-snog-slider-wrap .upk-main-slider .upk-image-wrap::before' => 'background-image: linear-gradient(54deg, {{VALUE}}, transparent);',
448 ],
449 'condition' => [
450 'overlay_type' => ['background', 'blend'],
451 ],
452 ]
453 );
454
455 $this->add_control(
456 'blend_type',
457 [
458 'label' => esc_html__('Blend Type', 'ultimate-post-kit'),
459 'type' => Controls_Manager::SELECT,
460 'default' => 'multiply',
461 'options' => ultimate_post_kit_blend_options(),
462 'condition' => [
463 'overlay_type' => 'blend',
464 ],
465 'selectors' => [
466 '{{WRAPPER}} .upk-snog-slider-wrap .upk-main-slider .upk-image-wrap::before' => 'mix-blend-mode: {{VALUE}};'
467 ],
468 ]
469 );
470
471
472 $this->add_group_control(
473 Group_Control_Background::get_type(),
474 [
475 'name' => 'content_background',
476 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-content-wrap',
477 ]
478 );
479
480 $this->add_group_control(
481 Group_Control_Border::get_type(),
482 [
483 'name' => 'content_border',
484 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-content-wrap',
485 ]
486 );
487
488 $this->add_responsive_control(
489 'content_border_radius',
490 [
491 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
492 'type' => Controls_Manager::DIMENSIONS,
493 'size_units' => ['px', '%'],
494 'selectors' => [
495 '{{WRAPPER}} .upk-snog-slider-wrap .upk-content-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
496 ],
497 ]
498 );
499
500 $this->add_responsive_control(
501 'content_padding',
502 [
503 'label' => __('Content Padding', 'ultimate-post-kit'),
504 'type' => Controls_Manager::DIMENSIONS,
505 'size_units' => ['px', 'em', '%'],
506 'selectors' => [
507 '{{WRAPPER}} .upk-snog-slider-wrap .upk-inner-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
508 ],
509 ]
510 );
511
512 $this->end_controls_section();
513
514 $this->start_controls_section(
515 'section_style_title',
516 [
517 'label' => esc_html__('Title', 'ultimate-post-kit'),
518 'tab' => Controls_Manager::TAB_STYLE,
519 'condition' => [
520 'show_title' => 'yes',
521 ],
522 ]
523 );
524
525 $this->add_control(
526 'title_style',
527 [
528 'label' => esc_html__('Style', 'ultimate-post-kit'),
529 'type' => Controls_Manager::SELECT,
530 'default' => 'default',
531 'options' => [
532 'default' => esc_html__('Default', 'ultimate-post-kit'),
533 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
534 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
535 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
536 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
537 ],
538 ]
539 );
540
541 $this->add_control(
542 'title_color',
543 [
544 'label' => esc_html__('Color', 'ultimate-post-kit'),
545 'type' => Controls_Manager::COLOR,
546 'selectors' => [
547 '{{WRAPPER}} .upk-snog-slider-wrap .upk-title a' => 'color: {{VALUE}};',
548 ],
549 ]
550 );
551
552 $this->add_control(
553 'title_hover_color',
554 [
555 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
556 'type' => Controls_Manager::COLOR,
557 'selectors' => [
558 '{{WRAPPER}} .upk-snog-slider-wrap .upk-title a:hover' => 'color: {{VALUE}};',
559 ],
560 ]
561 );
562
563 $this->add_responsive_control(
564 'title_padding',
565 [
566 'label' => __('Padding', 'ultimate-post-kit'),
567 'type' => Controls_Manager::DIMENSIONS,
568 'size_units' => ['px', 'em', '%'],
569 'selectors' => [
570 '{{WRAPPER}} .upk-snog-slider-wrap .upk-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
571 ],
572 ]
573 );
574
575 $this->add_responsive_control(
576 'title_margin',
577 [
578 'label' => __('Margin', 'ultimate-post-kit'),
579 'type' => Controls_Manager::DIMENSIONS,
580 'size_units' => ['px', 'em', '%'],
581 'selectors' => [
582 '{{WRAPPER}} .upk-snog-slider-wrap .upk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
583 ],
584 ]
585 );
586
587 $this->add_group_control(
588 Group_Control_Typography::get_type(),
589 [
590 'name' => 'title_typography',
591 'label' => esc_html__('Typography', 'ultimate-post-kit'),
592 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-title',
593 ]
594 );
595
596 $this->add_group_control(
597 Group_Control_Text_Shadow::get_type(),
598 [
599 'name' => 'title_text_shadow',
600 'label' => __('Text Shadow', 'ultimate-post-kit'),
601 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-title a',
602 ]
603 );
604
605 $this->add_group_control(
606 Group_Control_Text_Stroke::get_type(),
607 [
608 'name' => 'title_text_stroke',
609 'label' => __('Text Stroke', 'ultimate-post-kit') . BDTUPK_NC,
610 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-title a',
611 ]
612 );
613
614 $this->end_controls_section();
615
616 $this->start_controls_section(
617 'section_style_text',
618 [
619 'label' => esc_html__('Text', 'ultimate-post-kit'),
620 'tab' => Controls_Manager::TAB_STYLE,
621 'condition' => [
622 'show_excerpt' => 'yes',
623 ],
624 ]
625 );
626
627 $this->add_control(
628 'text_color',
629 [
630 'label' => esc_html__('Color', 'ultimate-post-kit'),
631 'type' => Controls_Manager::COLOR,
632 'selectors' => [
633 '{{WRAPPER}} .upk-snog-slider-wrap .upk-text' => 'color: {{VALUE}};',
634 ],
635 ]
636 );
637
638 $this->add_responsive_control(
639 'text_margin',
640 [
641 'label' => __('Margin', 'ultimate-post-kit'),
642 'type' => Controls_Manager::DIMENSIONS,
643 'size_units' => ['px', 'em', '%'],
644 'selectors' => [
645 '{{WRAPPER}} .upk-snog-slider-wrap .upk-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
646 ]
647 ]
648 );
649
650 $this->add_group_control(
651 Group_Control_Typography::get_type(),
652 [
653 'name' => 'text_typography',
654 'label' => esc_html__('Typography', 'ultimate-post-kit'),
655 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-text',
656 ]
657 );
658
659 $this->end_controls_section();
660
661 $this->start_controls_section(
662 'section_style_meta',
663 [
664 'label' => esc_html__( 'Meta', 'ultimate-post-kit' ),
665 'tab' => Controls_Manager::TAB_STYLE,
666 'conditions' => [
667 'relation' => 'or',
668 'terms' => [
669 [
670 'name' => 'show_author',
671 'value' => 'yes'
672 ],
673 [
674 'name' => 'show_date',
675 'value' => 'yes'
676 ],
677 ]
678 ],
679 ]
680 );
681
682 $this->add_control(
683 'meta_color',
684 [
685 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
686 'type' => Controls_Manager::COLOR,
687 'selectors' => [
688 '{{WRAPPER}} .upk-snog-slider-wrap .upk-meta, {{WRAPPER}} .upk-snog-slider-wrap .upk-meta .upk-author .upk-name' => 'color: {{VALUE}};',
689 ],
690 ]
691 );
692
693 $this->add_control(
694 'meta_hover_color',
695 [
696 'label' => esc_html__( 'Hover Color', 'ultimate-post-kit' ),
697 'type' => Controls_Manager::COLOR,
698 'selectors' => [
699 '{{WRAPPER}} .upk-snog-slider-wrap .upk-meta .upk-author .upk-name:hover' => 'color: {{VALUE}};',
700 ],
701 ]
702 );
703
704 $this->add_responsive_control(
705 'meta_spacing',
706 [
707 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
708 'type' => Controls_Manager::SLIDER,
709 'range' => [
710 'px' => [
711 'min' => 0,
712 'max' => 50,
713 ],
714 ],
715 'selectors' => [
716 '{{WRAPPER}} .upk-snog-slider-wrap .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
717 ],
718 ]
719 );
720
721 $this->add_responsive_control(
722 'meta_margin',
723 [
724 'label' => esc_html__('Margin', 'ultimate-post-kit'),
725 'type' => Controls_Manager::DIMENSIONS,
726 'size_units' => ['px', 'em', '%'],
727 'selectors' => [
728 '{{WRAPPER}} .upk-snog-slider .upk-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
729 ],
730 ]
731 );
732
733 $this->add_group_control(
734 Group_Control_Typography::get_type(),
735 [
736 'name' => 'meta_typography',
737 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
738 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-meta',
739 ]
740 );
741
742 $this->end_controls_section();
743
744 $this->start_controls_section(
745 'section_style_category',
746 [
747 'label' => esc_html__('Category', 'ultimate-post-kit'),
748 'tab' => Controls_Manager::TAB_STYLE,
749 'condition' => [
750 'show_category' => 'yes'
751 ],
752 ]
753 );
754
755 $this->add_responsive_control(
756 'category_bottom_spacing',
757 [
758 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
759 'type' => Controls_Manager::SLIDER,
760 'range' => [
761 'px' => [
762 'min' => 0,
763 'max' => 50,
764 ],
765 ],
766 'selectors' => [
767 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category' => 'margin-bottom: {{SIZE}}{{UNIT}};',
768 ],
769 ]
770 );
771
772 $this->start_controls_tabs('tabs_category_style');
773
774 $this->start_controls_tab(
775 'tab_category_normal',
776 [
777 'label' => esc_html__('Normal', 'ultimate-post-kit'),
778 ]
779 );
780
781 $this->add_control(
782 'category_color',
783 [
784 'label' => esc_html__('Color', 'ultimate-post-kit'),
785 'type' => Controls_Manager::COLOR,
786 'selectors' => [
787 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a' => 'color: {{VALUE}};',
788 ],
789 ]
790 );
791
792 $this->add_group_control(
793 Group_Control_Background::get_type(),
794 [
795 'name' => 'category_background',
796 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a',
797 ]
798 );
799
800 $this->add_group_control(
801 Group_Control_Border::get_type(),
802 [
803 'name' => 'category_border',
804 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a',
805 ]
806 );
807
808 $this->add_responsive_control(
809 'category_border_radius',
810 [
811 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
812 'type' => Controls_Manager::DIMENSIONS,
813 'size_units' => ['px', '%'],
814 'selectors' => [
815 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
816 ],
817 ]
818 );
819
820 $this->add_responsive_control(
821 'category_padding',
822 [
823 'label' => esc_html__('Padding', 'ultimate-post-kit'),
824 'type' => Controls_Manager::DIMENSIONS,
825 'size_units' => ['px', 'em', '%'],
826 'selectors' => [
827 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
828 ],
829 ]
830 );
831
832 $this->add_responsive_control(
833 'category_spacing',
834 [
835 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
836 'type' => Controls_Manager::SLIDER,
837 'range' => [
838 'px' => [
839 'min' => 0,
840 'max' => 50,
841 ],
842 ],
843 'selectors' => [
844 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
845 ],
846 ]
847 );
848
849 $this->add_group_control(
850 Group_Control_Box_Shadow::get_type(),
851 [
852 'name' => 'category_shadow',
853 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a',
854 ]
855 );
856
857 $this->add_group_control(
858 Group_Control_Typography::get_type(),
859 [
860 'name' => 'category_typography',
861 'label' => esc_html__('Typography', 'ultimate-post-kit'),
862 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a',
863 ]
864 );
865
866 $this->end_controls_tab();
867
868 $this->start_controls_tab(
869 'tab_category_hover',
870 [
871 'label' => esc_html__('Hover', 'ultimate-post-kit'),
872 'condition' => [
873 'show_category' => 'yes'
874 ]
875 ]
876 );
877
878 $this->add_control(
879 'category_hover_color',
880 [
881 'label' => esc_html__('Color', 'ultimate-post-kit'),
882 'type' => Controls_Manager::COLOR,
883 'selectors' => [
884 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a:hover' => 'color: {{VALUE}};',
885 ],
886 ]
887 );
888
889 $this->add_group_control(
890 Group_Control_Background::get_type(),
891 [
892 'name' => 'category_hover_background',
893 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a:hover',
894 ]
895 );
896
897 $this->add_control(
898 'category_hover_border_color',
899 [
900 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
901 'type' => Controls_Manager::COLOR,
902 'condition' => [
903 'category_border_border!' => '',
904 ],
905 'selectors' => [
906 '{{WRAPPER}} .upk-snog-slider-wrap .upk-category a:hover' => 'border-color: {{VALUE}};',
907 ],
908 ]
909 );
910
911 $this->end_controls_tab();
912
913 $this->end_controls_tabs();
914
915 $this->end_controls_section();
916
917
918 $this->start_controls_section(
919 'section_style_link_btn',
920 [
921 'label' => esc_html__('Read More', 'ultimate-post-kit'),
922 'tab' => Controls_Manager::TAB_STYLE,
923 'condition' => [
924 'show_readmore' => 'yes'
925 ],
926 ]
927 );
928
929 $this->start_controls_tabs('tabs_link_btn_style');
930
931 $this->start_controls_tab(
932 'tab_link_btn_normal',
933 [
934 'label' => esc_html__('Normal', 'ultimate-post-kit'),
935 ]
936 );
937
938 $this->add_control(
939 'link_btn_color',
940 [
941 'label' => esc_html__('Color', 'ultimate-post-kit'),
942 'type' => Controls_Manager::COLOR,
943 'selectors' => [
944 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a' => 'color: {{VALUE}};',
945 ],
946 ]
947 );
948
949 $this->add_group_control(
950 Group_Control_Background::get_type(),
951 [
952 'name' => 'link_btn_background',
953 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a',
954 ]
955 );
956
957 $this->add_group_control(
958 Group_Control_Border::get_type(),
959 [
960 'name' => 'link_btn_border',
961 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a',
962 ]
963 );
964
965 $this->add_responsive_control(
966 'link_btn_border_radius',
967 [
968 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
969 'type' => Controls_Manager::DIMENSIONS,
970 'size_units' => ['px', '%'],
971 'selectors' => [
972 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
973 ],
974 ]
975 );
976
977 $this->add_responsive_control(
978 'link_btn_padding',
979 [
980 'label' => esc_html__('Padding', 'ultimate-post-kit'),
981 'type' => Controls_Manager::DIMENSIONS,
982 'size_units' => ['px', 'em', '%'],
983 'selectors' => [
984 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
985 ],
986 ]
987 );
988
989
990 $this->add_group_control(
991 Group_Control_Box_Shadow::get_type(),
992 [
993 'name' => 'link_btn_shadow',
994 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a',
995 ]
996 );
997
998 $this->add_group_control(
999 Group_Control_Typography::get_type(),
1000 [
1001 'name' => 'link_btn_typography',
1002 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1003 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a',
1004 ]
1005 );
1006
1007 $this->end_controls_tab();
1008
1009 $this->start_controls_tab(
1010 'tab_link_btn_hover',
1011 [
1012 'label' => esc_html__('Hover', 'ultimate-post-kit'),
1013 ]
1014 );
1015
1016 $this->add_control(
1017 'link_btn_hover_color',
1018 [
1019 'label' => esc_html__('Color', 'ultimate-post-kit'),
1020 'type' => Controls_Manager::COLOR,
1021 'selectors' => [
1022 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a:hover' => 'color: {{VALUE}};',
1023 ],
1024 ]
1025 );
1026
1027 $this->add_group_control(
1028 Group_Control_Background::get_type(),
1029 [
1030 'name' => 'link_btn_hover_background',
1031 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a:hover',
1032 ]
1033 );
1034
1035 $this->add_control(
1036 'link_btn_hover_border_color',
1037 [
1038 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1039 'type' => Controls_Manager::COLOR,
1040 'selectors' => [
1041 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a:hover' => 'border-color: {{VALUE}};',
1042 ],
1043 ]
1044 );
1045
1046 $this->end_controls_tab();
1047
1048 $this->end_controls_tabs();
1049
1050 $this->add_control(
1051 'link_btn_line_heading',
1052 [
1053 'label' => esc_html__( 'LINE', 'ultimate-post-kit' ),
1054 'type' => Controls_Manager::HEADING,
1055 'separator' => 'before',
1056 ]
1057 );
1058
1059 $this->add_control(
1060 'link_btn_line_color',
1061 [
1062 'label' => esc_html__('Color', 'ultimate-post-kit'),
1063 'type' => Controls_Manager::COLOR,
1064 'selectors' => [
1065 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a::before' => 'background-color: {{VALUE}};',
1066 ],
1067 ]
1068 );
1069
1070 $this->add_control(
1071 'link_btn_line_hover_color',
1072 [
1073 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
1074 'type' => Controls_Manager::COLOR,
1075 'selectors' => [
1076 '{{WRAPPER}} .upk-snog-slider-wrap .upk-link-btn a:hover::before' => 'background-color: {{VALUE}};',
1077 ],
1078 ]
1079 );
1080
1081
1082
1083 $this->end_controls_section();
1084
1085
1086 $this->start_controls_section(
1087 'section_style_navigation',
1088 [
1089 'label' => esc_html__('Navigation', 'ultimate-post-kit'),
1090 'tab' => Controls_Manager::TAB_STYLE,
1091 'condition' => [
1092 'show_navigation' => 'yes'
1093 ],
1094 ]
1095 );
1096
1097 $this->add_control(
1098 'nav_arrows_icon',
1099 [
1100 'label' => esc_html__('Arrows Icon', 'ultimate-post-kit'),
1101 'type' => Controls_Manager::SELECT,
1102 'default' => '0',
1103 'options' => [
1104 '0' => esc_html__('Default', 'ultimate-post-kit'),
1105 '1' => esc_html__('Style 1', 'ultimate-post-kit'),
1106 '2' => esc_html__('Style 2', 'ultimate-post-kit'),
1107 '3' => esc_html__('Style 3', 'ultimate-post-kit'),
1108 '4' => esc_html__('Style 4', 'ultimate-post-kit'),
1109 '5' => esc_html__('Style 5', 'ultimate-post-kit'),
1110 '6' => esc_html__('Style 6', 'ultimate-post-kit'),
1111 '7' => esc_html__('Style 7', 'ultimate-post-kit'),
1112 '8' => esc_html__('Style 8', 'ultimate-post-kit'),
1113 '9' => esc_html__('Style 9', 'ultimate-post-kit'),
1114 '10' => esc_html__('Style 10', 'ultimate-post-kit'),
1115 '11' => esc_html__('Style 11', 'ultimate-post-kit'),
1116 '12' => esc_html__('Style 12', 'ultimate-post-kit'),
1117 '13' => esc_html__('Style 13', 'ultimate-post-kit'),
1118 '14' => esc_html__('Style 14', 'ultimate-post-kit'),
1119 '15' => esc_html__('Style 15', 'ultimate-post-kit'),
1120 '16' => esc_html__('Style 16', 'ultimate-post-kit'),
1121 '17' => esc_html__('Style 17', 'ultimate-post-kit'),
1122 '18' => esc_html__('Style 18', 'ultimate-post-kit'),
1123 'circle-1' => esc_html__('Style 19', 'ultimate-post-kit'),
1124 'circle-2' => esc_html__('Style 20', 'ultimate-post-kit'),
1125 'circle-3' => esc_html__('Style 21', 'ultimate-post-kit'),
1126 'circle-4' => esc_html__('Style 22', 'ultimate-post-kit'),
1127 'square-1' => esc_html__('Style 23', 'ultimate-post-kit'),
1128 ],
1129 ]
1130 );
1131
1132 $this->start_controls_tabs('tabs_navigation_arrows_style');
1133
1134 $this->start_controls_tab(
1135 'tabs_nav_arrows_normal',
1136 [
1137 'label' => __('Normal', 'ultimate-post-kit'),
1138
1139 ]
1140 );
1141
1142 $this->add_control(
1143 'arrows_color',
1144 [
1145 'label' => __('Color', 'ultimate-post-kit'),
1146 'type' => Controls_Manager::COLOR,
1147 'selectors' => [
1148 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn i' => 'color: {{VALUE}}',
1149 ],
1150
1151 ]
1152 );
1153
1154 $this->add_group_control(
1155 Group_Control_Background::get_type(),
1156 [
1157 'name' => 'arrows_background',
1158 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn',
1159 ]
1160 );
1161
1162 $this->add_group_control(
1163 Group_Control_Border::get_type(),
1164 [
1165 'name' => 'nav_arrows_border',
1166 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn',
1167
1168 ]
1169 );
1170
1171 $this->add_responsive_control(
1172 'border_radius',
1173 [
1174 'label' => __('Border Radius', 'ultimate-post-kit'),
1175 'type' => Controls_Manager::DIMENSIONS,
1176 'size_units' => ['px', '%'],
1177 'selectors' => [
1178 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1179 ],
1180
1181 ]
1182 );
1183
1184 $this->add_responsive_control(
1185 'arrows_padding',
1186 [
1187 'label' => esc_html__('Padding', 'ultimate-post-kit'),
1188 'type' => Controls_Manager::DIMENSIONS,
1189 'size_units' => ['px', 'em', '%'],
1190 'selectors' => [
1191 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1192 ],
1193
1194 ]
1195 );
1196
1197 $this->add_responsive_control(
1198 'arrows_margin',
1199 [
1200 'label' => esc_html__('Margin', 'ultimate-post-kit'),
1201 'type' => Controls_Manager::DIMENSIONS,
1202 'size_units' => ['px', 'em', '%'],
1203 'selectors' => [
1204 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1205 ],
1206
1207 ]
1208 );
1209
1210 $this->add_responsive_control(
1211 'arrows_size',
1212 [
1213 'label' => __('Size', 'ultimate-post-kit'),
1214 'type' => Controls_Manager::SLIDER,
1215 'range' => [
1216 'px' => [
1217 'min' => 10,
1218 'max' => 100,
1219 ],
1220 ],
1221 'selectors' => [
1222 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn i' => 'font-size: {{SIZE || 18}}{{UNIT}};',
1223 ],
1224 ]
1225 );
1226
1227 $this->end_controls_tab();
1228
1229 $this->start_controls_tab(
1230 'tabs_nav_arrows_hover',
1231 [
1232 'label' => __('Hover', 'ultimate-post-kit'),
1233
1234 ]
1235 );
1236
1237 $this->add_control(
1238 'arrows_hover_color',
1239 [
1240 'label' => __('Color', 'ultimate-post-kit'),
1241 'type' => Controls_Manager::COLOR,
1242 'selectors' => [
1243 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn:hover i' => 'color: {{VALUE}}',
1244 ],
1245
1246 ]
1247 );
1248
1249 $this->add_group_control(
1250 Group_Control_Background::get_type(),
1251 [
1252 'name' => 'arrows_hover_background',
1253 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn:hover',
1254 ]
1255 );
1256
1257 $this->add_control(
1258 'nav_arrows_hover_border_color',
1259 [
1260 'label' => __('Border Color', 'ultimate-post-kit'),
1261 'type' => Controls_Manager::COLOR,
1262 'selectors' => [
1263 '{{WRAPPER}} .upk-snog-slider-wrap .upk-nav-btn:hover' => 'border-color: {{VALUE}};',
1264 ],
1265 'condition' => [
1266 'nav_arrows_border_border!' => ''
1267 ]
1268 ]
1269 );
1270
1271 $this->end_controls_tab();
1272
1273 $this->end_controls_tabs();
1274
1275 $this->end_controls_section();
1276
1277
1278 // Pagination Css Control
1279
1280 $this->start_controls_section (
1281 'section_style_pagination',
1282 [
1283 'label' => esc_html__('Pagination', 'ultimate-post-kit'),
1284 'tab' => Controls_Manager::TAB_STYLE,
1285 'condition' => [
1286 'show_pagination' => 'yes'
1287 ],
1288 ]
1289 );
1290
1291 $this->add_control(
1292 'pagination_color',
1293 [
1294 'label' => esc_html__('Color', 'ultimate-post-kit'),
1295 'type' => Controls_Manager::COLOR,
1296 'selectors' => [
1297 '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .swiper-pagination-bullet' => 'color: {{VALUE}};',
1298 '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .swiper-pagination-bullet::after' => 'background: {{VALUE}};',
1299 ],
1300 ]
1301 );
1302
1303 $this->add_group_control(
1304 Group_Control_Typography::get_type(),
1305 [
1306 'name' => 'pagination_typography',
1307 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1308 'selector' => '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .swiper-pagination-bullet',
1309 ]
1310 );
1311
1312 $this->add_responsive_control(
1313 'pagination_spacing',
1314 [
1315 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
1316 'type' => Controls_Manager::SLIDER,
1317 'range' => [
1318 'px' => [
1319 'min' => 0,
1320 'max' => 50,
1321 ],
1322 ],
1323 'selectors' => [
1324 '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .upk-pagination' => 'grid-row-gap: {{SIZE}}{{UNIT}};',
1325 ],
1326 ]
1327 );
1328
1329 $this->add_control(
1330 'pagination_active_heading',
1331 [
1332 'label' => esc_html__( 'A C T I V E', 'ultimate-post-kit' ),
1333 'type' => Controls_Manager::HEADING,
1334 'separator' => 'before',
1335 ]
1336 );
1337
1338 $this->add_control(
1339 'pagination_active_color',
1340 [
1341 'label' => esc_html__('Active Color', 'ultimate-post-kit'),
1342 'type' => Controls_Manager::COLOR,
1343 'selectors' => [
1344 '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .swiper-pagination-bullet-active' => 'color: {{VALUE}};',
1345 '{{WRAPPER}} .upk-snog-slider-wrap .upk-pagination-wrap .swiper-pagination-bullet-active::after' => 'background: {{VALUE}};',
1346 ],
1347 ]
1348 );
1349
1350 $this->end_controls_section();
1351
1352 }
1353
1354 /**
1355 * Main query render for this widget
1356 * @param $posts_per_page number item query limit
1357 */
1358 public function query_posts( $posts_per_page ) {
1359
1360 $default = $this->getGroupControlQueryArgs();
1361 $args = [];
1362 if ( $posts_per_page ) {
1363 $args['posts_per_page'] = $posts_per_page;
1364 }
1365 $args = array_merge( $default, $args );
1366 $this->_query = new WP_Query( $args );
1367 }
1368
1369 public function render_author() {
1370
1371 if ( ! $this->get_settings( 'show_author' ) ) {
1372 return;
1373 }
1374 ?>
1375 <div class="upk-author">
1376 <span class="upk-by"><?php echo esc_html_x( 'by ', 'Frontend', 'ultimate-post-kit' ) ?></span>
1377 <a class="upk-name" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) ?>">
1378 <?php echo esc_html( get_the_author() ) ?>
1379 </a>
1380 </div>
1381 <?php
1382 }
1383
1384
1385 public function render_header() {
1386 $settings = $this->get_settings_for_display();
1387 $id = 'upk-snog-slider-' . $this->get_id();
1388
1389 $this->add_render_attribute( 'snog-slider', 'class', ['upk-snog-slider'] );
1390
1391 $this->add_render_attribute(
1392 [
1393 'snog-slider' => [
1394 'data-settings' => [
1395 wp_json_encode(array_filter([
1396 "autoplay" => ( "yes" == $settings["autoplay"] ) ? [ "delay" => $settings["autoplay_speed"] ] : false,
1397 "loop" => ($settings["loop"] == "yes") ? true : false,
1398 "speed" => $settings["speed"]["size"],
1399 "effect" => 'slide',
1400 "lazy" => true,
1401 "grabCursor" => ($settings["grab_cursor"] === "yes") ? true : false,
1402 "pauseOnHover" => ("yes" == $settings["pauseonhover"]) ? true : false,
1403 "slidesPerView" => 1,
1404 "observer" => ($settings["observer"]) ? true : false,
1405 "observeParents" => ($settings["observer"]) ? true : false,
1406 "loopedSlides" => 4,
1407 // "allowTouchMove" => false,
1408 "lazy" => [
1409 "loadPrevNext" => "true",
1410 ],
1411 ]))
1412 ],
1413 'data-widget-settings' => [
1414 wp_json_encode(
1415 [
1416 'id' => '#' . $id
1417 ]
1418 )
1419 ]
1420 ]
1421 ]
1422 );
1423
1424 $this->add_render_attribute('swiper', 'class', 'upk-main-slider swiper');
1425
1426 ?>
1427 <div <?php $this->print_render_attribute_string( 'snog-slider' ); ?>>
1428 <div <?php $this->print_render_attribute_string('swiper'); ?>>
1429 <div class="swiper-wrapper">
1430 <?php
1431 }
1432
1433 public function render_footer() {
1434 $settings = $this->get_settings_for_display();
1435
1436 ?>
1437
1438 </div>
1439 <?php if($settings['show_pagination']) : ?>
1440 <div class="upk-pagination-wrap">
1441 <div class="upk-pagination"></div>
1442 </div>
1443 <?php endif; ?>
1444
1445 </div>
1446 </div>
1447
1448 <?php
1449 }
1450
1451 function render_excerpt($excerpt_length) {
1452 if (!$this->get_settings('show_excerpt')) {
1453 return;
1454 }
1455 $strip_shortcode = $this->get_settings_for_display('strip_shortcode');
1456 ?>
1457 <div class="upk-text" data-swiper-parallax-y ="-100" data-swiper-parallax-duration="700">
1458 <?php
1459 if (has_excerpt()) {
1460 the_excerpt();
1461 } else {
1462 echo wp_kses_post( ultimate_post_kit_custom_excerpt($excerpt_length, $strip_shortcode) );
1463 }
1464 ?>
1465 </div>
1466 <?php
1467 }
1468
1469 public function render_post_grid_item($post_id, $image_size) {
1470 $settings = $this->get_settings_for_display();
1471
1472 $this->add_render_attribute('slider-item', 'class', 'upk-item swiper-slide', true);
1473
1474 ?>
1475 <div <?php $this->print_render_attribute_string('slider-item'); ?>>
1476 <div class="upk-image-wrap">
1477 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1478 </div>
1479 </div>
1480 <?php
1481 }
1482
1483 public function render_content_item($excerpt_length) {
1484 $settings = $this->get_settings_for_display();
1485
1486 $this->add_render_attribute('slider-item', 'class', 'upk-item swiper-slide', true);
1487
1488 ?>
1489 <div <?php $this->print_render_attribute_string('slider-item'); ?>>
1490 <div class="upk-content-wrap">
1491 <div class="upk-inner-content">
1492 <?php if ( $settings['show_category'] ) : ?>
1493 <div data-swiper-parallax-x ="-60" data-swiper-parallax-duration="500">
1494 <?php $this->render_category(); ?>
1495 </div>
1496 <?php endif; ?>
1497
1498 <?php if ( $settings['show_author'] or $settings['show_date'] or $settings['show_reading_time'] ) : ?>
1499 <div class="upk-meta" data-swiper-parallax-x ="-60" data-swiper-parallax-duration="600">
1500 <?php $this->render_author(); ?>
1501
1502 <?php if ($settings['show_date'] == 'yes') : ?>
1503 <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1504 <?php $this->render_date(); ?>
1505 </div>
1506 <?php endif; ?>
1507
1508 <?php if (_is_upk_pro_activated()) :
1509 if ('yes' === $settings['show_reading_time']) : ?>
1510 <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1511 <?php echo esc_html( ultimate_post_kit_reading_time(get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no') ); ?>
1512 </div>
1513 <?php endif; ?>
1514 <?php endif; ?>
1515
1516 </div>
1517 <?php endif; ?>
1518
1519 <?php if ( $settings['show_title'] ) : ?>
1520 <div data-swiper-parallax-x ="-60" data-swiper-parallax-duration="700">
1521 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1522 </div>
1523 <?php endif; ?>
1524
1525 <?php $this->render_excerpt($excerpt_length); ?>
1526
1527 <?php if ($settings['show_readmore'] === 'yes' and !empty($settings['readmore_text'])) : ?>
1528 <div class="upk-link-btn" data-swiper-parallax-x ="-60" data-swiper-parallax-duration="800">
1529 <a href="<?php echo esc_url(get_permalink()); ?>">
1530 <span><?php echo esc_html($settings['readmore_text']); ?></span>
1531 </a>
1532 </div>
1533 <?php endif; ?>
1534
1535 </div>
1536 </div>
1537 </div>
1538 <?php
1539 }
1540
1541 public function render_thumbnav($post_id, $image_size) {
1542 $settings = $this->get_settings_for_display();
1543
1544 $this->add_render_attribute('thumb-item', 'class', 'upk-item swiper-slide', true);
1545
1546 ?>
1547 <div <?php $this->print_render_attribute_string('thumb-item'); ?>>
1548 <div class="upk-image-wrap">
1549 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1550 </div>
1551 </div>
1552 <?php
1553
1554 }
1555
1556 public function render() {
1557 $settings = $this->get_settings_for_display();
1558 $id = 'upk-snog-slider-' . $this->get_id();
1559
1560 $this->query_posts($settings['item_limit']['size']);
1561 $wp_query = $this->get_query();
1562
1563 if (!$wp_query->found_posts) {
1564 return;
1565 }
1566
1567 $this->add_render_attribute('swiper-thumbs', 'class', 'upk-snog-thumbs swiper');
1568 $this->add_render_attribute('swiper-content', 'class', 'upk-content-slider swiper');
1569
1570 ?>
1571 <div class="upk-snog-slider-wrap" id="<?php echo esc_attr($id); ?>">
1572 <?php
1573
1574 $this->render_header();
1575
1576 while ( $wp_query->have_posts() ) {
1577 $wp_query->the_post();
1578 $thumbnail_size = $settings['primary_thumbnail_size'];
1579
1580 $this->render_post_grid_item( get_the_ID(), $thumbnail_size );
1581 }
1582
1583 $this->render_footer();
1584
1585 ?>
1586 <div thumbsSlider="" <?php $this->print_render_attribute_string('swiper-thumbs'); ?>>
1587 <div class="swiper-wrapper">
1588 <?php
1589
1590 while ( $wp_query->have_posts() ) {
1591 $wp_query->the_post();
1592 $thumbnail_size = $settings['primary_thumbnail_size'];
1593
1594 $this->render_thumbnav( get_the_ID(), $thumbnail_size );
1595 }
1596
1597 ?>
1598 </div>
1599 </div>
1600
1601 <div <?php $this->print_render_attribute_string('swiper-content'); ?>>
1602 <div class="swiper-wrapper">
1603 <?php
1604 while ( $wp_query->have_posts() ) {
1605 $wp_query->the_post();
1606
1607 $this->render_content_item( $settings['excerpt_length']);
1608 }
1609 ?>
1610 </div>
1611
1612 <?php if ($settings['show_navigation']) : ?>
1613 <div class="upk-navigation-wrap">
1614 <div class="upk-nav-btn upk-navigation-prev">
1615 <i class="upk-icon-arrow-left-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" aria-hidden="true"></i>
1616 </div>
1617 <div class="upk-nav-btn upk-navigation-next">
1618 <i class="upk-icon-arrow-right-<?php echo esc_attr($settings['nav_arrows_icon']); ?>" aria-hidden="true"></i>
1619 </div>
1620 </div>
1621 <?php endif; ?>
1622 </div>
1623
1624 </div>
1625
1626 <?php
1627 wp_reset_postdata();
1628 }
1629 }
1630