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

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

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