PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.14
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.14
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 / amox-carousel / widgets / amox-carousel.php

amox-carousel.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.1.14, at modules/amox-carousel/widgets/amox-carousel.php

948 lines 22.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\AmoxCarousel\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_Image_Size;
11 use Elementor\Group_Control_Background;
12
13 use UltimatePostKit\Traits\Global_Widget_Controls;
14 use UltimatePostKit\Traits\Global_Widget_Functions;
15 use UltimatePostKit\Traits\Global_Swiper_Functions;
16 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
17 use WP_Query;
18
19 if (!defined('ABSPATH')) exit; // Exit if accessed directly
20
21 class Amox_Carousel extends Group_Control_Query
22 {
23
24 use Global_Widget_Controls;
25 use Global_Widget_Functions;
26 use Global_Swiper_Functions;
27
28 private $_query = null;
29
30 public function get_name()
31 {
32 return 'upk-amox-carousel';
33 }
34
35 public function get_title()
36 {
37 return BDTUPK . esc_html__('Amox Carousel', 'ultimate-post-kit');
38 }
39
40 public function get_icon()
41 {
42 return 'upk-widget-icon upk-icon-amox-carousel';
43 }
44
45 public function get_categories()
46 {
47 return ['ultimate-post-kit'];
48 }
49
50 public function get_keywords()
51 {
52 return ['post', 'carousel', 'blog', 'recent', 'news', 'amox'];
53 }
54
55 public function get_style_depends()
56 {
57 if ($this->upk_is_edit_mode()) {
58 return ['swiper', 'upk-all-styles'];
59 } else {
60 return ['swiper', 'upk-font', 'upk-amox-carousel'];
61 }
62 }
63
64 public function get_script_depends()
65 {
66 if ($this->upk_is_edit_mode()) {
67 return ['swiper', 'upk-all-scripts'];
68 } else {
69 return ['swiper', 'upk-amox-carousel'];
70 }
71 }
72
73 public function get_custom_help_url()
74 {
75 return 'https://youtu.be/3FoLaHsyB0g';
76 }
77
78 public function get_query()
79 {
80 return $this->_query;
81 }
82
83 public function has_widget_inner_wrapper(): bool {
84 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
85 }
86
87
88 protected function register_controls() {
89 $this->start_controls_section(
90 'section_content_layout',
91 [
92 'label' => esc_html__('Layout', 'ultimate-post-kit'),
93 ]
94 );
95
96 $this->add_responsive_control(
97 'columns',
98 [
99 'label' => __('Columns', 'ultimate-post-kit'),
100 'type' => Controls_Manager::SELECT,
101 'default' => 3,
102 'tablet_default' => 2,
103 'mobile_default' => 1,
104 'options' => [
105 1 => '1',
106 2 => '2',
107 3 => '3',
108 4 => '4',
109 5 => '5',
110 6 => '6',
111 ],
112 ]
113 );
114
115 $this->add_responsive_control(
116 'item_gap',
117 [
118 'label' => __('Item Gap', 'ultimate-post-kit'),
119 'type' => Controls_Manager::SLIDER,
120 'default' => [
121 'size' => 20,
122 ],
123 'tablet_default' => [
124 'size' => 20,
125 ],
126 'mobile_default' => [
127 'size' => 20,
128 ],
129 'range' => [
130 'px' => [
131 'min' => 0,
132 'max' => 100,
133 ],
134 ],
135 ]
136 );
137
138 $this->add_responsive_control(
139 'image_height',
140 [
141 'label' => esc_html__('Image Height', 'ultimate-post-kit') . BDTUPK_NC,
142 'type' => Controls_Manager::SLIDER,
143 'range' => [
144 'px' => [
145 'min' => 100,
146 'max' => 800,
147 ],
148 ],
149 'selectors' => [
150 '{{WRAPPER}} .upk-amox-carousel .upk-img-wrap' => 'height: {{SIZE}}px;',
151 ],
152 ]
153 );
154
155 $this->add_group_control(
156 Group_Control_Image_Size::get_type(),
157 [
158 'name' => 'primary_thumbnail',
159 'exclude' => ['custom'],
160 'default' => 'medium',
161 ]
162 );
163
164 $this->add_responsive_control(
165 'content_alignment',
166 [
167 'label' => __('Alignment', 'ultimate-post-kit'),
168 'type' => Controls_Manager::CHOOSE,
169 'options' => [
170 'left' => [
171 'title' => __('Left', 'ultimate-post-kit'),
172 'icon' => 'eicon-text-align-left',
173 ],
174 'center' => [
175 'title' => __('Center', 'ultimate-post-kit'),
176 'icon' => 'eicon-text-align-center',
177 ],
178 'right' => [
179 'title' => __('Right', 'ultimate-post-kit'),
180 'icon' => 'eicon-text-align-right',
181 ],
182 ],
183 'selectors' => [
184 '{{WRAPPER}} .upk-amox-carousel .upk-item .upk-content' => 'text-align: {{VALUE}};',
185 ],
186 ]
187 );
188
189 $this->add_control(
190 'carousel_active_item',
191 [
192 'label' => __('Carousel Active Item', 'ultimate-post-kit') . BDTUPK_PC,
193 'type' => Controls_Manager::SWITCHER,
194 'prefix_class' => 'upk-amox-carousel-active--',
195 'render_type' => 'template',
196 'separator' => 'before',
197 'classes' => BDTUPK_IS_PC,
198 ]
199 );
200
201 $this->add_control(
202 'active_item',
203 [
204 'label' => __('Custom Active Item', 'ultimate-post-kit') . BDTUPK_PC,
205 'type' => Controls_Manager::NUMBER,
206 'default' => 2,
207 'description' => __('Be more creative with your design by typing in your item number.', 'ultimate-post-kit'),
208 'classes' => BDTUPK_IS_PC,
209 'condition' => [
210 'carousel_active_item' => ''
211 ],
212 'render_type' => 'template'
213 ]
214 );
215
216 $this->end_controls_section();
217
218 //New Query Builder Settings
219 $this->start_controls_section(
220 'section_post_query_builder',
221 [
222 'label' => __('Query', 'ultimate-post-kit'),
223 'tab' => Controls_Manager::TAB_CONTENT,
224 ]
225 );
226
227 $this->add_control(
228 'item_limit',
229 [
230 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
231 'type' => Controls_Manager::SLIDER,
232 'range' => [
233 'px' => [
234 'min' => 0,
235 'max' => 21,
236 ],
237 ],
238 'default' => [
239 'size' => 6,
240 ],
241 'condition' => [
242 'posts_source!' => 'current_query',
243 ]
244 ]
245 );
246
247 $this->register_query_builder_controls();
248
249 $this->end_controls_section();
250
251 $this->start_controls_section(
252 'section_content_additional',
253 [
254 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
255 ]
256 );
257
258 //Global Title Controls
259 $this->register_title_controls();
260
261 $this->add_control(
262 'show_category',
263 [
264 'label' => esc_html__('Category', 'ultimate-post-kit'),
265 'type' => Controls_Manager::SWITCHER,
266 'default' => 'yes',
267 'separator' => 'before'
268 ]
269 );
270
271 //Global Date Controls
272 $this->register_date_controls();
273
274 //Global Reading Time Controls
275 $this->register_reading_time_controls();
276
277 $this->add_control(
278 'meta_separator',
279 [
280 'label' => __('Separator', 'ultimate-post-kit') . BDTUPK_NC,
281 'type' => Controls_Manager::TEXT,
282 'default' => '.',
283 'label_block' => false,
284 ]
285 );
286
287
288
289 $this->add_control(
290 'show_comments',
291 [
292 'label' => esc_html__('Show Comments', 'ultimate-post-kit'),
293 'type' => Controls_Manager::SWITCHER,
294 'default' => 'yes',
295 ]
296 );
297
298 $this->add_control(
299 'item_match_height',
300 [
301 'label' => __('Item Match Height', 'ultimate-post-kit'),
302 'type' => Controls_Manager::SWITCHER,
303 'default' => 'yes',
304 'prefix_class' => 'upk-item-match-height--',
305 'separator' => 'before'
306 ]
307 );
308
309 $this->add_control(
310 'global_link',
311 [
312 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
313 'type' => Controls_Manager::SWITCHER,
314 'prefix_class' => 'upk-global-link-',
315 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
316 ]
317 );
318
319 $this->end_controls_section();
320
321 //Navigaiton Global Controls
322 $this->register_navigation_controls('amox');
323
324 //Style
325 $this->start_controls_section(
326 'upk_section_style',
327 [
328 'label' => esc_html__('Items', 'ultimate-post-kit'),
329 'tab' => Controls_Manager::TAB_STYLE,
330 ]
331 );
332
333 $this->add_responsive_control(
334 'content_padding',
335 [
336 'label' => __('Content Padding', 'ultimate-post-kit'),
337 'type' => Controls_Manager::DIMENSIONS,
338 'size_units' => ['px', 'em', '%'],
339 'selectors' => [
340 '{{WRAPPER}} .upk-amox-carousel .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
341 ],
342 ]
343 );
344
345 $this->start_controls_tabs('tabs_item_style');
346
347 $this->start_controls_tab(
348 'tab_item_normal',
349 [
350 'label' => esc_html__('Normal', 'ultimate-post-kit'),
351 ]
352 );
353
354 $this->add_group_control(
355 Group_Control_Background::get_type(),
356 [
357 'name' => 'content_background',
358 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-item',
359 ]
360 );
361
362 $this->add_group_control(
363 Group_Control_Border::get_type(),
364 [
365 'name' => 'item_border',
366 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-item',
367 ]
368 );
369
370 $this->add_responsive_control(
371 'item_border_radius',
372 [
373 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
374 'type' => Controls_Manager::DIMENSIONS,
375 'size_units' => ['px', '%'],
376 'selectors' => [
377 '{{WRAPPER}} .upk-amox-carousel .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
378 ],
379 ]
380 );
381
382 $this->add_responsive_control(
383 'item_padding',
384 [
385 'label' => __('Padding', 'ultimate-post-kit'),
386 'type' => Controls_Manager::DIMENSIONS,
387 'size_units' => ['px', 'em', '%'],
388 'selectors' => [
389 '{{WRAPPER}} .upk-amox-carousel .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
390 ],
391 ]
392 );
393
394 $this->add_group_control(
395 Group_Control_Box_Shadow::get_type(),
396 [
397 'name' => 'item_box_shadow',
398 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-item',
399 ]
400 );
401
402 $this->end_controls_tab();
403
404 $this->start_controls_tab(
405 'tab_item_hover',
406 [
407 'label' => esc_html__('Hover', 'ultimate-post-kit'),
408 ]
409 );
410
411 $this->add_group_control(
412 Group_Control_Background::get_type(),
413 [
414 'name' => 'content_hover_background',
415 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-item:hover',
416 ]
417 );
418
419 $this->add_control(
420 'item_hover_border_color',
421 [
422 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
423 'type' => Controls_Manager::COLOR,
424 'condition' => [
425 'item_border_border!' => '',
426 ],
427 'selectors' => [
428 '{{WRAPPER}} .upk-amox-carousel .upk-item:hover' => 'border-color: {{VALUE}};',
429 ],
430 ]
431 );
432
433 $this->add_group_control(
434 Group_Control_Box_Shadow::get_type(),
435 [
436 'name' => 'item_hover_box_shadow',
437 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-item:hover',
438 ]
439 );
440
441 $this->add_responsive_control(
442 'item_shadow_padding',
443 [
444 'label' => __('Match Padding', 'ultimate-post-kit'),
445 'description' => __('You have to add padding for matching overlaping normal/hover box shadow when you used Box Shadow option.', 'ultimate-post-kit'),
446 'type' => Controls_Manager::SLIDER,
447 'range' => [
448 'px' => [
449 'min' => 0,
450 'step' => 1,
451 'max' => 50,
452 ]
453 ],
454 'selectors' => [
455 '{{WRAPPER}} .swiper-carousel' => 'padding: {{SIZE}}{{UNIT}}; margin: 0 -{{SIZE}}{{UNIT}};'
456 ],
457 ]
458 );
459
460 $this->end_controls_tab();
461
462 $this->end_controls_tabs();
463
464 $this->end_controls_section();
465
466 $this->start_controls_section(
467 'section_style_title',
468 [
469 'label' => esc_html__('Title', 'ultimate-post-kit'),
470 'tab' => Controls_Manager::TAB_STYLE,
471 'condition' => [
472 'show_title' => 'yes',
473 ],
474 ]
475 );
476
477 $this->add_control(
478 'title_style',
479 [
480 'label' => esc_html__('Style', 'ultimate-post-kit'),
481 'type' => Controls_Manager::SELECT,
482 'default' => 'underline',
483 'options' => [
484 '' => esc_html__('Default', 'ultimate-post-kit'),
485 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
486 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
487 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
488 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
489 ],
490 ]
491 );
492
493 $this->add_responsive_control(
494 'title_spacing',
495 [
496 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
497 'type' => Controls_Manager::SLIDER,
498 'range' => [
499 'px' => [
500 'min' => 0,
501 'max' => 50,
502 ],
503 ],
504 'selectors' => [
505 '{{WRAPPER}} .upk-amox-carousel .upk-title' => 'padding-bottom: {{SIZE}}{{UNIT}};',
506 ],
507 ]
508 );
509
510 $this->add_group_control(
511 Group_Control_Typography::get_type(),
512 [
513 'name' => 'title_typography',
514 'label' => esc_html__('Typography', 'ultimate-post-kit'),
515 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-title',
516 ]
517 );
518
519 $this->add_group_control(
520 Group_Control_Text_Shadow::get_type(),
521 [
522 'name' => 'title_text_shadow',
523 'label' => __('Text Shadow', 'ultimate-post-kit'),
524 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-title',
525 ]
526 );
527
528 $this->start_controls_tabs('tabs_title_style');
529
530 $this->start_controls_tab(
531 'tab_title_normal',
532 [
533 'label' => esc_html__('Normal', 'ultimate-post-kit'),
534 ]
535 );
536
537 $this->add_control(
538 'title_color',
539 [
540 'label' => esc_html__('Color', 'ultimate-post-kit'),
541 'type' => Controls_Manager::COLOR,
542 'selectors' => [
543 '{{WRAPPER}} .upk-amox-carousel .upk-title a' => 'color: {{VALUE}};',
544 ],
545 ]
546 );
547
548 $this->end_controls_tab();
549
550 $this->start_controls_tab(
551 'tab_title_hover',
552 [
553 'label' => esc_html__('Hover', 'ultimate-post-kit'),
554 ]
555 );
556
557 $this->add_control(
558 'title_color_hover',
559 [
560 'label' => esc_html__('Color', 'ultimate-post-kit'),
561 'type' => Controls_Manager::COLOR,
562 'selectors' => [
563 '{{WRAPPER}} .upk-amox-carousel .upk-title a:hover' => 'color: {{VALUE}};',
564 ],
565 ]
566 );
567
568 $this->end_controls_tab();
569
570 $this->end_controls_tabs();
571
572 $this->end_controls_section();
573
574 $this->start_controls_section(
575 'section_style_meta',
576 [
577 'label' => esc_html__('Meta', 'ultimate-post-kit'),
578 'tab' => Controls_Manager::TAB_STYLE,
579 'conditions' => [
580 'relation' => 'or',
581 'terms' => [
582 [
583 'name' => 'show_date',
584 'value' => 'yes'
585 ],
586 [
587 'name' => 'show_comments',
588 'value' => 'yes'
589 ]
590 ]
591 ],
592 ]
593 );
594
595 $this->add_control(
596 'meta_color',
597 [
598 'label' => esc_html__('Color', 'ultimate-post-kit'),
599 'type' => Controls_Manager::COLOR,
600 'selectors' => [
601 '{{WRAPPER}} .upk-amox-carousel .upk-meta' => 'color: {{VALUE}};',
602 ],
603 ]
604 );
605
606 $this->add_responsive_control(
607 'meta_space_between',
608 [
609 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
610 'type' => Controls_Manager::SLIDER,
611 'range' => [
612 'px' => [
613 'min' => 0,
614 'max' => 50,
615 ],
616 ],
617 'selectors' => [
618 '{{WRAPPER}} .upk-amox-carousel .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
619 ],
620 ]
621 );
622
623 $this->add_group_control(
624 Group_Control_Typography::get_type(),
625 [
626 'name' => 'meta_typography',
627 'label' => esc_html__('Typography', 'ultimate-post-kit'),
628 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-meta',
629 ]
630 );
631
632 $this->end_controls_section();
633
634 $this->start_controls_section(
635 'section_style_category',
636 [
637 'label' => esc_html__('Category', 'ultimate-post-kit'),
638 'tab' => Controls_Manager::TAB_STYLE,
639 'condition' => [
640 'show_category' => 'yes',
641 ],
642 ]
643 );
644
645 $this->add_responsive_control(
646 'category_bottom_spacing',
647 [
648 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
649 'type' => Controls_Manager::SLIDER,
650 'range' => [
651 'px' => [
652 'min' => 0,
653 'max' => 50,
654 ],
655 ],
656 'selectors' => [
657 '{{WRAPPER}} .upk-amox-carousel .upk-category' => 'margin-bottom: {{SIZE}}{{UNIT}};',
658 ],
659 ]
660 );
661
662 $this->start_controls_tabs('tabs_category_style');
663
664 $this->start_controls_tab(
665 'tab_category_normal',
666 [
667 'label' => esc_html__('Normal', 'ultimate-post-kit'),
668 ]
669 );
670
671 $this->add_control(
672 'category_color',
673 [
674 'label' => esc_html__('Color', 'ultimate-post-kit'),
675 'type' => Controls_Manager::COLOR,
676 'selectors' => [
677 '{{WRAPPER}} .upk-amox-carousel .upk-category a' => 'color: {{VALUE}};',
678 ],
679 ]
680 );
681
682 $this->add_group_control(
683 Group_Control_Background::get_type(),
684 [
685 'name' => 'category_background',
686 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-category a',
687 ]
688 );
689
690 $this->add_group_control(
691 Group_Control_Border::get_type(),
692 [
693 'name' => 'category_border',
694 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-category a',
695 ]
696 );
697
698 $this->add_responsive_control(
699 'category_border_radius',
700 [
701 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
702 'type' => Controls_Manager::DIMENSIONS,
703 'size_units' => ['px', '%'],
704 'selectors' => [
705 '{{WRAPPER}} .upk-amox-carousel .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
706 ],
707 ]
708 );
709
710 $this->add_responsive_control(
711 'category_padding',
712 [
713 'label' => esc_html__('Padding', 'ultimate-post-kit'),
714 'type' => Controls_Manager::DIMENSIONS,
715 'size_units' => ['px', 'em', '%'],
716 'selectors' => [
717 '{{WRAPPER}} .upk-amox-carousel .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
718 ],
719 ]
720 );
721
722 $this->add_responsive_control(
723 'category_spacing',
724 [
725 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
726 'type' => Controls_Manager::SLIDER,
727 'range' => [
728 'px' => [
729 'min' => 0,
730 'max' => 50,
731 'step' => 2,
732 ],
733 ],
734 'selectors' => [
735 '{{WRAPPER}} .upk-amox-carousel .upk-category' => 'gap: {{SIZE}}{{UNIT}};',
736 ],
737 ]
738 );
739
740 $this->add_group_control(
741 Group_Control_Box_Shadow::get_type(),
742 [
743 'name' => 'category_shadow',
744 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-category a',
745 ]
746 );
747
748 $this->add_group_control(
749 Group_Control_Typography::get_type(),
750 [
751 'name' => 'category_typography',
752 'label' => esc_html__('Typography', 'ultimate-post-kit'),
753 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-category a',
754 ]
755 );
756
757 $this->end_controls_tab();
758
759 $this->start_controls_tab(
760 'tab_category_hover',
761 [
762 'label' => esc_html__('Hover', 'ultimate-post-kit'),
763 ]
764 );
765
766 $this->add_control(
767 'category_hover_color',
768 [
769 'label' => esc_html__('Color', 'ultimate-post-kit'),
770 'type' => Controls_Manager::COLOR,
771 'selectors' => [
772 '{{WRAPPER}} .upk-amox-carousel .upk-category a:hover' => 'color: {{VALUE}};',
773 ],
774 ]
775 );
776
777 $this->add_group_control(
778 Group_Control_Background::get_type(),
779 [
780 'name' => 'category_hover_background',
781 'selector' => '{{WRAPPER}} .upk-amox-carousel .upk-category a:hover',
782 ]
783 );
784
785 $this->add_control(
786 'category_hover_border_color',
787 [
788 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
789 'type' => Controls_Manager::COLOR,
790 'condition' => [
791 'category_border_border!' => '',
792 ],
793 'selectors' => [
794 '{{WRAPPER}} .upk-amox-carousel .upk-category a:hover' => 'border-color: {{VALUE}};',
795 ],
796 ]
797 );
798
799 $this->end_controls_tab();
800
801 if (_is_upk_pro_activated()) {
802
803 $this->start_controls_tab(
804 'tab_category_active',
805 [
806 'label' => esc_html__('Active', 'ultimate-post-kit'),
807 ]
808 );
809
810 $this->add_control(
811 'category_active_normal_heading',
812 [
813 'label' => esc_html__('NORMAL', 'ultimate-post-kit'),
814 'type' => Controls_Manager::HEADING,
815 ]
816 );
817
818 $this->end_controls_tab();
819 }
820
821 $this->end_controls_tabs();
822
823 $this->end_controls_section();
824
825 //Navigation Global Controls
826 $this->register_navigation_style('swiper');
827 }
828
829 /**
830 * Main query render for this widget
831 * @param $posts_per_page number item query limit
832 */
833 public function query_posts($posts_per_page)
834 {
835
836 $default = $this->getGroupControlQueryArgs();
837 $args = [];
838 if ($posts_per_page) {
839 $args['posts_per_page'] = $posts_per_page;
840 }
841 $args = array_merge($default, $args);
842 $this->_query = new WP_Query($args);
843 }
844
845 public function render_comments($id = 0)
846 {
847
848 if (!$this->get_settings('show_comments')) {
849 return;
850 }
851 ?>
852
853 <div class="upk-comments upk-flex upk-flex-middle">
854 <i class="upk-icon-post-comments" aria-hidden="true"></i>
855 <span><?php echo esc_html( $this->upk_get_localized_comment_count( $id ) ); ?></span>
856 </div>
857
858 <?php
859 }
860
861 public function render_header()
862 {
863 //Global Function
864 $this->render_header_attribute('amox');
865
866 ?>
867 <div <?php $this->print_render_attribute_string('carousel'); ?>>
868 <div class="upk-post-wrapper">
869 <div <?php $this->print_render_attribute_string('swiper'); ?>>
870 <div class="swiper-wrapper">
871 <?php
872 }
873
874 public function render_post_grid_item($post_id, $image_size, $active_item)
875 {
876 $settings = $this->get_settings_for_display();
877
878 if ('yes' == $settings['global_link']) {
879
880 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
881 }
882
883 $this->add_render_attribute('grid-item', 'class', 'upk-item swiper-slide ' . $active_item, true);
884
885 ?>
886 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
887 <div class="upk-img-wrap">
888 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
889 </div>
890 <div class="upk-content">
891 <?php $this->render_category(); ?>
892 <?php $this->render_title(substr($this->get_name(), 4)); ?>
893
894 <?php if ($settings['show_comments'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
895 <div class="upk-meta upk-flex-inline upk-flex-middle">
896 <?php $this->render_date(); ?>
897 <?php if (_is_upk_pro_activated()) :
898 if ('yes' === $settings['show_reading_time']) : ?>
899 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
900 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
901 </div>
902 <?php endif; ?>
903 <?php endif; ?>
904 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
905 <?php $this->render_comments($post_id); ?>
906 </div>
907 </div>
908 <?php endif; ?>
909 </div>
910 </div>
911
912
913 <?php
914 }
915
916 public function render()
917 {
918 $settings = $this->get_settings_for_display();
919
920 $this->query_posts($settings['item_limit']['size']);
921 $wp_query = $this->get_query();
922
923 if (!$wp_query->found_posts) {
924 return;
925 }
926
927 $this->render_header();
928
929 $i = 0;
930 while ($wp_query->have_posts()) {
931 $wp_query->the_post();
932 $thumbnail_size = $settings['primary_thumbnail_size'];
933
934 $active_item = '';
935 $i++;
936 if (_is_upk_pro_activated()) {
937 $active_item = apply_filters('amox_carousel_active_item', $this, $i);
938 }
939
940 $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $active_item);
941 }
942
943 $this->render_footer();
944
945 wp_reset_postdata();
946 }
947 }
948