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

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