PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.2.0
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.2.0
4.5.6 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 All 148 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.2.0, at modules/snog-slider/widgets/snog-slider.php

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