PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.0
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.0
4.5.6 4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 All 148 releases
ultimate-post-kit / modules / 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.1.0, at modules/buzz-list-carousel/widgets/buzz-list-carousel.php

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