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.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 4.1.4 All 146 releases
ultimate-post-kit / modules / ramble-carousel / widgets / ramble-carousel.php

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

1,412 lines 36.3 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\RambleCarousel\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 use Elementor\Icons_Manager;
13
14 use UltimatePostKit\Traits\Global_Widget_Controls;
15 use UltimatePostKit\Traits\Global_Widget_Functions;
16 use UltimatePostKit\Traits\Global_Swiper_Functions;
17 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
18 use WP_Query;
19
20 if (!defined('ABSPATH')) exit; // Exit if accessed directly
21
22 class Ramble_Carousel extends Group_Control_Query {
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 return 'upk-ramble-carousel';
32 }
33
34 public function get_title() {
35 return BDTUPK . esc_html__('Ramble Carousel', 'ultimate-post-kit');
36 }
37
38 public function get_icon() {
39 return 'upk-widget-icon upk-icon-ramble-carousel';
40 }
41
42 public function get_categories() {
43 return ['ultimate-post-kit'];
44 }
45
46 public function get_keywords() {
47 return ['post', 'carousel', 'blog', 'recent', 'news', 'ramble'];
48 }
49
50 public function get_style_depends() {
51 if ($this->upk_is_edit_mode()) {
52 return ['swiper', 'upk-all-styles'];
53 } else {
54 return ['swiper', 'upk-font', 'upk-ramble-carousel'];
55 }
56 }
57
58 public function get_script_depends() {
59 if ($this->upk_is_edit_mode()) {
60 return ['swiper', 'upk-all-scripts'];
61 } else {
62 return ['swiper', 'upk-ramble-carousel'];
63 }
64 }
65
66 public function get_custom_help_url() {
67 return 'https://youtu.be/vv10IM0pCHA';
68 }
69
70 public function on_import($element) {
71 if (!get_post_type_object($element['settings']['posts_post_type'])) {
72 $element['settings']['posts_post_type'] = 'post';
73 }
74
75 return $element;
76 }
77
78 public function get_query() {
79 return $this->_query;
80 }
81
82 public function has_widget_inner_wrapper(): bool {
83 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
84 }
85
86
87 protected function register_controls() {
88 $this->start_controls_section(
89 'section_content_layout',
90 [
91 'label' => esc_html__('Layout', 'ultimate-post-kit'),
92 ]
93 );
94
95 $this->add_responsive_control(
96 'columns',
97 [
98 'label' => __('Columns', 'ultimate-post-kit'),
99 'type' => Controls_Manager::SELECT,
100 'default' => 3,
101 'tablet_default' => 2,
102 'mobile_default' => 1,
103 'options' => [
104 1 => '1',
105 2 => '2',
106 3 => '3',
107 4 => '4',
108 5 => '5',
109 6 => '6',
110 ],
111 ]
112 );
113
114 $this->add_responsive_control(
115 'item_gap',
116 [
117 'label' => __('Item Gap', 'ultimate-post-kit'),
118 'type' => Controls_Manager::SLIDER,
119 'default' => [
120 'size' => 20,
121 ],
122 'tablet_default' => [
123 'size' => 20,
124 ],
125 'mobile_default' => [
126 'size' => 20,
127 ],
128 'range' => [
129 'px' => [
130 'min' => 0,
131 'max' => 100,
132 ],
133 ],
134 ]
135 );
136
137 $this->add_responsive_control(
138 'item_height',
139 [
140 'label' => esc_html__('Item Height(px)', 'ultimate-post-kit'),
141 'type' => Controls_Manager::SLIDER,
142 'range' => [
143 'px' => [
144 'min' => 200,
145 'max' => 600,
146 ],
147 ],
148 'selectors' => [
149 '{{WRAPPER}} .upk-ramble-carousel .upk-item' => 'height: {{SIZE}}{{UNIT}};',
150 ],
151 ]
152 );
153
154 $this->add_group_control(
155 Group_Control_Image_Size::get_type(),
156 [
157 'name' => 'primary_thumbnail',
158 'exclude' => ['custom'],
159 'default' => 'medium',
160 ]
161 );
162
163 $this->end_controls_section();
164
165 // Query Settings
166 $this->start_controls_section(
167 'section_post_query_builder',
168 [
169 'label' => __('Query', 'ultimate-post-kit'),
170 'tab' => Controls_Manager::TAB_CONTENT,
171 ]
172 );
173
174 $this->add_control(
175 'item_limit',
176 [
177 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
178 'type' => Controls_Manager::SLIDER,
179 'range' => [
180 'px' => [
181 'min' => 1,
182 'max' => 20,
183 ],
184 ],
185 'default' => [
186 'size' => 6,
187 ],
188 ]
189 );
190
191 $this->register_query_builder_controls();
192
193 $this->end_controls_section();
194
195 $this->start_controls_section(
196 'section_content_additional',
197 [
198 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
199 ]
200 );
201
202 //Global Title Controls
203 $this->register_title_controls();
204 $this->register_text_controls();
205
206 $this->add_control(
207 'show_author_avatar',
208 [
209 'label' => esc_html__('Author Avatar', 'ultimate-post-kit'),
210 'type' => Controls_Manager::SWITCHER,
211 'default' => 'yes',
212 ]
213 );
214
215 $this->add_control(
216 'show_author_name',
217 [
218 'label' => esc_html__('Author Name', 'ultimate-post-kit'),
219 'type' => Controls_Manager::SWITCHER,
220 'default' => 'yes',
221 ]
222 );
223
224 //Global Date Controls
225 $this->register_date_controls();
226
227 //Global Reading Time Controls
228 $this->register_reading_time_controls();
229
230 $this->add_control(
231 'meta_separator',
232 [
233 'label' => __('Separator', 'ultimate-post-kit'),
234 'type' => Controls_Manager::TEXT,
235 'default' => '/',
236 'label_block' => false,
237 ]
238 );
239
240 $this->add_control(
241 'show_category',
242 [
243 'label' => esc_html__('Category', 'ultimate-post-kit'),
244 'type' => Controls_Manager::SWITCHER,
245 'default' => 'yes',
246 'separator' => 'before'
247 ]
248 );
249
250 $this->add_control(
251 'show_comments',
252 [
253 'label' => esc_html__('Show Comments', 'ultimate-post-kit'),
254 'type' => Controls_Manager::SWITCHER,
255 'default' => 'yes',
256 ]
257 );
258
259 $this->add_control(
260 'show_readmore',
261 [
262 'label' => esc_html__('Read More', 'ultimate-post-kit'),
263 'type' => Controls_Manager::SWITCHER,
264 'default' => 'yes',
265 'separator' => 'before'
266 ]
267 );
268
269 $this->add_control(
270 'readmore_text',
271 [
272 'label' => esc_html__('Read More Text', 'ultimate-post-kit'),
273 'type' => Controls_Manager::TEXT,
274 'dynamic' => [ 'active' => true ],
275 'default' => esc_html__('Read More', 'ultimate-post-kit'),
276 'placeholder' => esc_html__('Read More', 'ultimate-post-kit'),
277 'condition' => [
278 'show_readmore' => 'yes',
279 ],
280 ]
281 );
282
283 $this->add_control(
284 'readmore_icon',
285 [
286 'label' => esc_html__('Icon', 'ultimate-post-kit'),
287 'type' => Controls_Manager::ICONS,
288 'label_block' => false,
289 'skin' => 'inline',
290 'condition' => [
291 'show_readmore' => 'yes',
292 ]
293 ]
294 );
295
296 $this->add_control(
297 'icon_align',
298 [
299 'label' => esc_html__('Icon Position', 'ultimate-post-kit'),
300 'type' => Controls_Manager::SELECT,
301 'default' => 'right',
302 'options' => [
303 'left' => esc_html__('Left', 'ultimate-post-kit'),
304 'right' => esc_html__('Right', 'ultimate-post-kit'),
305 ],
306 'condition' => [
307 'readmore_icon[value]!' => '',
308 ],
309 ]
310 );
311
312 $this->add_control(
313 'icon_indent',
314 [
315 'label' => esc_html__('Icon Spacing', 'ultimate-post-kit'),
316 'type' => Controls_Manager::SLIDER,
317 'default' => [
318 'size' => 8,
319 ],
320 'range' => [
321 'px' => [
322 'max' => 50,
323 ],
324 ],
325 'condition' => [
326 'readmore_icon[value]!' => '',
327 ],
328 'selectors' => [
329 '{{WRAPPER}} .upk-ramble-carousel .upk-flex-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};',
330 '{{WRAPPER}} .upk-ramble-carousel .upk-flex-align-left' => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};',
331 ],
332 ]
333 );
334
335 $this->add_control(
336 'global_link',
337 [
338 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
339 'type' => Controls_Manager::SWITCHER,
340 'prefix_class' => 'upk-global-link-',
341 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
342 'separator' => 'before'
343 ]
344 );
345
346 $this->end_controls_section();
347
348 //Navigaiton Global Controls
349 $this->register_navigation_controls('ramble');
350
351 //Style
352 $this->start_controls_section(
353 'upk_section_style',
354 [
355 'label' => esc_html__('Items', 'ultimate-post-kit'),
356 'tab' => Controls_Manager::TAB_STYLE,
357 ]
358 );
359
360 $this->add_responsive_control(
361 'content_padding',
362 [
363 'label' => __('Content Padding', 'ultimate-post-kit'),
364 'type' => Controls_Manager::DIMENSIONS,
365 'size_units' => ['px', 'em', '%'],
366 'selectors' => [
367 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-show, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
368 ],
369 ]
370 );
371
372 $this->start_controls_tabs('tabs_item_style');
373
374 $this->start_controls_tab(
375 'tab_item_normal',
376 [
377 'label' => esc_html__('Normal', 'ultimate-post-kit'),
378 ]
379 );
380
381 $this->add_control(
382 'overlay_background',
383 [
384 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
385 'type' => Controls_Manager::COLOR,
386 'selectors' => [
387 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-img-wrap:before' => 'background-color: {{VALUE}};'
388 ],
389 ]
390 );
391
392 $this->add_group_control(
393 Group_Control_Border::get_type(),
394 [
395 'name' => 'item_border',
396 'label' => __('Border', 'ultimate-post-kit'),
397 'placeholder' => '1px',
398 'default' => '1px',
399 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item',
400 ]
401 );
402
403 $this->add_responsive_control(
404 'item_border_radius',
405 [
406 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
407 'type' => Controls_Manager::DIMENSIONS,
408 'size_units' => ['px', '%'],
409 'selectors' => [
410 '{{WRAPPER}} .upk-ramble-carousel .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
411 ],
412 ]
413 );
414
415 $this->add_group_control(
416 Group_Control_Box_Shadow::get_type(),
417 [
418 'name' => 'item_box_shadow',
419 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item',
420 ]
421 );
422
423 $this->end_controls_tab();
424
425 $this->start_controls_tab(
426 'tab_item_hover',
427 [
428 'label' => esc_html__('Hover', 'ultimate-post-kit'),
429 ]
430 );
431
432 $this->add_control(
433 'overlay_background_hover',
434 [
435 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
436 'type' => Controls_Manager::COLOR,
437 'selectors' => [
438 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-img-wrap:before' => 'background-color: {{VALUE}};'
439 ],
440 ]
441 );
442
443 $this->add_control(
444 'item_border_color_hover',
445 [
446 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
447 'type' => Controls_Manager::COLOR,
448 'selectors' => [
449 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover' => 'border-color: {{VALUE}};'
450 ],
451 'condition' => [
452 'item_border_border!' => ''
453 ]
454 ]
455 );
456
457 $this->add_group_control(
458 Group_Control_Box_Shadow::get_type(),
459 [
460 'name' => 'item_box_shadow_hover',
461 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover',
462 ]
463 );
464
465 $this->add_responsive_control(
466 'item_shadow_padding',
467 [
468 'label' => __('Match Padding', 'ultimate-post-kit'),
469 'description' => __('You have to add padding for matching overlaping normal/hover box shadow when you used Box Shadow option.', 'ultimate-post-kit'),
470 'type' => Controls_Manager::SLIDER,
471 'range' => [
472 'px' => [
473 'min' => 0,
474 'step' => 1,
475 'max' => 50,
476 ]
477 ],
478 'default' => [
479 'size' => 10
480 ],
481 'selectors' => [
482 '{{WRAPPER}} .swiper-carousel' => 'padding: {{SIZE}}{{UNIT}}; margin: 0 -{{SIZE}}{{UNIT}};'
483 ],
484 ]
485 );
486
487 $this->end_controls_tab();
488
489 $this->end_controls_tabs();
490
491 $this->end_controls_section();
492
493 $this->start_controls_section(
494 'section_style_title',
495 [
496 'label' => esc_html__('Title', 'ultimate-post-kit'),
497 'tab' => Controls_Manager::TAB_STYLE,
498 'condition' => [
499 'show_title' => 'yes',
500 ],
501 ]
502 );
503
504 $this->add_control(
505 'title_style',
506 [
507 'type' => Controls_Manager::HIDDEN,
508 ]
509 );
510
511 $this->add_control(
512 'title_color',
513 [
514 'label' => esc_html__('Color', 'ultimate-post-kit'),
515 'type' => Controls_Manager::COLOR,
516 'selectors' => [
517 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title a' => 'color: {{VALUE}};',
518 ],
519 ]
520 );
521
522 $this->add_group_control(
523 Group_Control_Typography::get_type(),
524 [
525 'name' => 'title_typography',
526 'label' => esc_html__('Typography', 'ultimate-post-kit'),
527 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title',
528 ]
529 );
530
531 $this->add_control(
532 'title_advanced_style',
533 [
534 'label' => esc_html__('Advanced Style', 'ultimate-post-kit'),
535 'type' => Controls_Manager::SWITCHER,
536 ]
537 );
538
539 $this->add_control(
540 'title_background',
541 [
542 'label' => esc_html__('Background', 'ultimate-post-kit'),
543 'type' => Controls_Manager::COLOR,
544 'selectors' => [
545 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title' => 'background-color: {{VALUE}};',
546 ],
547 'condition' => [
548 'title_advanced_style' => 'yes'
549 ]
550 ]
551 );
552
553 $this->add_group_control(
554 Group_Control_Text_Shadow::get_type(),
555 [
556 'name' => 'title_text_shadow',
557 'label' => __('Text Shadow', 'ultimate-post-kit'),
558 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title',
559 'condition' => [
560 'title_advanced_style' => 'yes'
561 ]
562 ]
563 );
564
565 $this->add_group_control(
566 Group_Control_Border::get_type(),
567 [
568 'name' => 'title_border',
569 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title',
570 'condition' => [
571 'title_advanced_style' => 'yes'
572 ]
573 ]
574 );
575
576 $this->add_responsive_control(
577 'title_border_radius',
578 [
579 'label' => __('Border Radius', 'ultimate-post-kit'),
580 'type' => Controls_Manager::DIMENSIONS,
581 'size_units' => ['px', '%'],
582 'selectors' => [
583 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
584 ],
585 'condition' => [
586 'title_advanced_style' => 'yes'
587 ]
588 ]
589 );
590
591 $this->add_group_control(
592 Group_Control_Box_Shadow::get_type(),
593 [
594 'name' => 'title_box_shadow',
595 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title',
596 'condition' => [
597 'title_advanced_style' => 'yes'
598 ]
599 ]
600 );
601
602 $this->add_responsive_control(
603 'title_text_padding',
604 [
605 'label' => __('Padding', 'ultimate-post-kit'),
606 'type' => Controls_Manager::DIMENSIONS,
607 'size_units' => ['px', 'em', '%'],
608 'selectors' => [
609 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
610 ],
611 'condition' => [
612 'title_advanced_style' => 'yes'
613 ]
614 ]
615 );
616
617 $this->add_responsive_control(
618 'title_text_margtin',
619 [
620 'label' => __('Margtin', 'ultimate-post-kit'),
621 'type' => Controls_Manager::DIMENSIONS,
622 'size_units' => ['px', 'em', '%'],
623 'selectors' => [
624 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-title' => 'margtin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
625 ],
626 'condition' => [
627 'title_advanced_style' => 'yes'
628 ]
629 ]
630 );
631
632 $this->end_controls_section();
633
634 $this->start_controls_section(
635 'section_text_style',
636 [
637 'label' => esc_html__('Text', 'ultimate-post-kit'),
638 'tab' => Controls_Manager::TAB_STYLE,
639 'condition' => [
640 'show_excerpt' => 'yes'
641 ],
642 ]
643 );
644
645 $this->add_control(
646 'text_color',
647 [
648 'label' => esc_html__('Color', 'ultimate-post-kit'),
649 'type' => Controls_Manager::COLOR,
650 'selectors' => [
651 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-text' => 'color: {{VALUE}};',
652 ],
653 ]
654 );
655
656 $this->add_group_control(
657 Group_Control_Typography::get_type(),
658 [
659 'name' => 'text_typography',
660 'label' => esc_html__('Typography', 'ultimate-post-kit'),
661 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-text',
662 ]
663 );
664
665 $this->end_controls_section();
666
667 $this->start_controls_section(
668 'section_style_author_date',
669 [
670 'label' => esc_html__('Author/Date', 'ultimate-post-kit'),
671 'tab' => Controls_Manager::TAB_STYLE,
672 'conditions' => [
673 'relation' => 'or',
674 'terms' => [
675 [
676 'name' => 'show_author_avatar',
677 'value' => 'yes'
678 ],
679 [
680 'name' => 'show_author_name',
681 'value' => 'yes'
682 ],
683 [
684 'name' => 'show_date',
685 'value' => 'yes'
686 ]
687 ]
688 ],
689 ]
690 );
691
692 $this->add_control(
693 'author_image_heading',
694 [
695 'label' => esc_html__('Author Avatar', 'ultimate-post-kit'),
696 'type' => Controls_Manager::HEADING,
697 'condition' => [
698 'show_author_avatar' => 'yes'
699 ]
700 ]
701 );
702
703 $this->add_group_control(
704 Group_Control_Border::get_type(),
705 [
706 'name' => 'author_iamge_border',
707 'label' => __('Border', 'ultimate-post-kit'),
708 'placeholder' => '1px',
709 'default' => '1px',
710 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-meta .upk-author-image img',
711 'condition' => [
712 'show_author_avatar' => 'yes'
713 ]
714 ]
715 );
716
717 $this->add_responsive_control(
718 'author_iamge_border_radius',
719 [
720 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
721 'type' => Controls_Manager::DIMENSIONS,
722 'size_units' => ['px', '%'],
723 'selectors' => [
724 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-meta .upk-author-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
725 ],
726 'condition' => [
727 'show_author_avatar' => 'yes'
728 ]
729 ]
730 );
731
732 $this->add_responsive_control(
733 'author_iamge_size',
734 [
735 'label' => esc_html__('Size', 'ultimate-post-kit'),
736 'type' => Controls_Manager::SLIDER,
737 'selectors' => [
738 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-meta .upk-author-image img' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};',
739 ],
740 'condition' => [
741 'show_author_avatar' => 'yes'
742 ]
743 ]
744 );
745
746 $this->add_responsive_control(
747 'author_iamge_spacing',
748 [
749 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
750 'type' => Controls_Manager::SLIDER,
751 'selectors' => [
752 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-meta .upk-author-image' => 'margin-right: {{SIZE}}{{UNIT}};',
753 ],
754 'condition' => [
755 'show_author_avatar' => 'yes'
756 ]
757 ]
758 );
759
760 $this->add_control(
761 'author_heading',
762 [
763 'label' => esc_html__('Author Name', 'ultimate-post-kit'),
764 'type' => Controls_Manager::HEADING,
765 'separator' => 'before',
766 'condition' => [
767 'show_author_name' => 'yes'
768 ]
769 ]
770 );
771
772 $this->add_control(
773 'author_color',
774 [
775 'label' => esc_html__('Color', 'ultimate-post-kit'),
776 'type' => Controls_Manager::COLOR,
777 'selectors' => [
778 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-author-name a' => 'color: {{VALUE}};',
779 ],
780 'condition' => [
781 'show_author_name' => 'yes'
782 ]
783 ]
784 );
785
786 $this->add_control(
787 'author_hover_color',
788 [
789 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
790 'type' => Controls_Manager::COLOR,
791 'selectors' => [
792 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-author-name a:hover' => 'color: {{VALUE}};',
793 ],
794 'condition' => [
795 'show_author_name' => 'yes'
796 ]
797 ]
798 );
799
800 $this->add_group_control(
801 Group_Control_Typography::get_type(),
802 [
803 'name' => 'author_typography',
804 'label' => esc_html__('Typography', 'ultimate-post-kit'),
805 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-author-name a',
806 'condition' => [
807 'show_author_name' => 'yes'
808 ]
809 ]
810 );
811
812 $this->add_control(
813 'date_heading',
814 [
815 'label' => esc_html__('Date/Time', 'ultimate-post-kit'),
816 'type' => Controls_Manager::HEADING,
817 'separator' => 'before',
818 'conditions' => [
819 'relation' => 'or',
820 'terms' => [
821 [
822 'name' => 'show_date',
823 'value' => 'yes'
824 ],
825 [
826 'name' => 'show_reading_time',
827 'value' => 'yes'
828 ]
829 ]
830 ],
831 ]
832 );
833
834 $this->add_control(
835 'date_color',
836 [
837 'label' => esc_html__('Color', 'ultimate-post-kit'),
838 'type' => Controls_Manager::COLOR,
839 'selectors' => [
840 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide .upk-date, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide .upk-post-time, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-reading-time' => 'color: {{VALUE}};',
841 ],
842 'conditions' => [
843 'relation' => 'or',
844 'terms' => [
845 [
846 'name' => 'show_date',
847 'value' => 'yes'
848 ],
849 [
850 'name' => 'show_reading_time',
851 'value' => 'yes'
852 ]
853 ]
854 ],
855 ]
856 );
857
858 $this->add_group_control(
859 Group_Control_Typography::get_type(),
860 [
861 'name' => 'date_typography',
862 'label' => esc_html__('Typography', 'ultimate-post-kit'),
863 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide .upk-date, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide .upk-post-time, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-reading-time',
864 'conditions' => [
865 'relation' => 'or',
866 'terms' => [
867 [
868 'name' => 'show_date',
869 'value' => 'yes'
870 ],
871 [
872 'name' => 'show_reading_time',
873 'value' => 'yes'
874 ]
875 ]
876 ],
877 ]
878 );
879
880 $this->add_responsive_control(
881 'date_spacing',
882 [
883 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
884 'type' => Controls_Manager::SLIDER,
885 'selectors' => [
886 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-default-hide .upk-date' => 'margin-top: {{SIZE}}{{UNIT}};',
887 ],
888 'condition' => [
889 'show_date' => 'yes'
890 ]
891 ]
892 );
893
894 $this->add_responsive_control(
895 'meta_space_between',
896 [
897 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
898 'type' => Controls_Manager::SLIDER,
899 'range' => [
900 'px' => [
901 'min' => 0,
902 'max' => 50,
903 ],
904 ],
905 'selectors' => [
906 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-reading-time > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
907 ],
908 'conditions' => [
909 'relation' => 'or',
910 'terms' => [
911 [
912 'name' => 'show_date',
913 'value' => 'yes'
914 ],
915 [
916 'name' => 'show_reading_time',
917 'value' => 'yes'
918 ]
919 ]
920 ],
921 ]
922 );
923
924 $this->end_controls_section();
925
926 $this->start_controls_section(
927 'section_style_category',
928 [
929 'label' => esc_html__('Category/Date', 'ultimate-post-kit'),
930 'tab' => Controls_Manager::TAB_STYLE,
931 'conditions' => [
932 'relation' => 'or',
933 'terms' => [
934 [
935 'name' => 'show_category',
936 'value' => 'yes'
937 ],
938 [
939 'name' => 'show_date',
940 'value' => 'yes'
941 ]
942 ]
943 ],
944 ]
945 );
946
947 $this->add_control(
948 'category_date_color',
949 [
950 'label' => esc_html__('Color', 'ultimate-post-kit'),
951 'type' => Controls_Manager::COLOR,
952 'selectors' => [
953 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-date, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-category a, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-post-time' => 'color: {{VALUE}};',
954 ],
955 ]
956 );
957
958 $this->add_control(
959 'category_date_divider_color',
960 [
961 'label' => esc_html__('Divider Color', 'ultimate-post-kit'),
962 'type' => Controls_Manager::COLOR,
963 'selectors' => [
964 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-category:before' => 'background: {{VALUE}};',
965 ],
966 'condition' => [
967 'show_category' => 'yes'
968 ]
969 ]
970 );
971
972 $this->add_responsive_control(
973 'category_date_spacing',
974 [
975 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
976 'type' => Controls_Manager::SLIDER,
977 'selectors' => [
978 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-category' => 'margin-left: {{SIZE}}{{UNIT}}; padding-left: {{SIZE}}{{UNIT}};',
979 ],
980 'condition' => [
981 'show_category' => 'yes'
982 ]
983 ]
984 );
985
986 $this->add_responsive_control(
987 'category_spacing',
988 [
989 'label' => esc_html__('Category Space Beween', 'ultimate-post-kit'),
990 'type' => Controls_Manager::SLIDER,
991 'range' => [
992 'px' => [
993 'min' => 0,
994 'max' => 50,
995 'step' => 2,
996 ],
997 ],
998 'selectors' => [
999 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
1000 ],
1001 'condition' => [
1002 'show_category' => 'yes'
1003 ]
1004 ]
1005 );
1006
1007 $this->add_group_control(
1008 Group_Control_Typography::get_type(),
1009 [
1010 'name' => 'category_date_typography',
1011 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1012 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-date, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-category a, {{WRAPPER}} .upk-ramble-carousel .upk-item .upk-date-cetagory-wrap .upk-post-time',
1013 ]
1014 );
1015
1016 $this->end_controls_section();
1017
1018 $this->start_controls_section(
1019 'section_style_readmore',
1020 [
1021 'label' => __('Read More', 'ultimate-post-kit'),
1022 'tab' => Controls_Manager::TAB_STYLE,
1023 'condition' => [
1024 'show_readmore' => 'yes',
1025 ],
1026 ]
1027 );
1028
1029 $this->start_controls_tabs('tabs_readmore_style');
1030
1031 $this->start_controls_tab(
1032 'tab_readmore_normal',
1033 [
1034 'label' => __('Normal', 'ultimate-post-kit'),
1035 ]
1036 );
1037
1038 $this->add_control(
1039 'readmore_text_color',
1040 [
1041 'label' => __('Color', 'ultimate-post-kit'),
1042 'type' => Controls_Manager::COLOR,
1043 'selectors' => [
1044 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore' => 'color: {{VALUE}};',
1045 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore svg *' => 'fill: {{VALUE}};',
1046 ],
1047 ]
1048 );
1049
1050 $this->add_group_control(
1051 Group_Control_Background::get_type(),
1052 [
1053 'name' => 'readmore_background',
1054 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore',
1055 ]
1056 );
1057
1058 $this->add_group_control(
1059 Group_Control_Border::get_type(),
1060 [
1061 'name' => 'readmore_border',
1062 'placeholder' => '1px',
1063 'default' => '1px',
1064 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore'
1065 ]
1066 );
1067
1068 $this->add_responsive_control(
1069 'readmore_radius',
1070 [
1071 'label' => __('Border Radius', 'ultimate-post-kit'),
1072 'type' => Controls_Manager::DIMENSIONS,
1073 'size_units' => ['px', '%'],
1074 'selectors' => [
1075 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1076 ],
1077 ]
1078 );
1079
1080 $this->add_responsive_control(
1081 'readmore_padding',
1082 [
1083 'label' => __('Padding', 'ultimate-post-kit'),
1084 'type' => Controls_Manager::DIMENSIONS,
1085 'size_units' => ['px', 'em', '%'],
1086 'selectors' => [
1087 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1088 ],
1089 ]
1090 );
1091
1092 $this->add_responsive_control(
1093 'readmore_margin',
1094 [
1095 'label' => __('Margin', 'ultimate-post-kit'),
1096 'type' => Controls_Manager::DIMENSIONS,
1097 'size_units' => ['px', 'em', '%'],
1098 'selectors' => [
1099 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1100 ],
1101 ]
1102 );
1103
1104 $this->add_group_control(
1105 Group_Control_Box_Shadow::get_type(),
1106 [
1107 'name' => 'readmore_shadow',
1108 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore',
1109 ]
1110 );
1111
1112 $this->add_group_control(
1113 Group_Control_Typography::get_type(),
1114 [
1115 'name' => 'readmore_typography',
1116 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-readmore',
1117 ]
1118 );
1119
1120 $this->end_controls_tab();
1121
1122 $this->start_controls_tab(
1123 'tab_readmore_hover',
1124 [
1125 'label' => __('Hover', 'ultimate-post-kit'),
1126 ]
1127 );
1128
1129 $this->add_control(
1130 'readmore_hover_text_color',
1131 [
1132 'label' => __('Color', 'ultimate-post-kit'),
1133 'type' => Controls_Manager::COLOR,
1134 'selectors' => [
1135 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-readmore' => 'color: {{VALUE}};',
1136 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-readmore svg *' => 'fill: {{VALUE}};',
1137 ],
1138 ]
1139 );
1140
1141 $this->add_group_control(
1142 Group_Control_Background::get_type(),
1143 [
1144 'name' => 'readmore_hover_background',
1145 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-readmore',
1146 ]
1147 );
1148
1149 $this->add_control(
1150 'readmore_hover_border_color',
1151 [
1152 'label' => __('Border Color', 'ultimate-post-kit'),
1153 'type' => Controls_Manager::COLOR,
1154 'selectors' => [
1155 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-readmore' => 'border-color: {{VALUE}};',
1156 ],
1157 'condition' => [
1158 'readmore_border_border!' => ''
1159 ]
1160 ]
1161 );
1162
1163 $this->add_group_control(
1164 Group_Control_Box_Shadow::get_type(),
1165 [
1166 'name' => 'readmore_hover_shadow',
1167 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-readmore',
1168 ]
1169 );
1170
1171 $this->add_control(
1172 'readmore_hover_animation',
1173 [
1174 'label' => __('Hover Animation', 'ultimate-post-kit'),
1175 'type' => Controls_Manager::HOVER_ANIMATION,
1176 ]
1177 );
1178
1179 $this->end_controls_tab();
1180
1181 $this->end_controls_tabs();
1182
1183 $this->end_controls_section();
1184
1185 $this->start_controls_section(
1186 'section_comments_style',
1187 [
1188 'label' => esc_html__('Comments', 'ultimate-post-kit'),
1189 'tab' => Controls_Manager::TAB_STYLE,
1190 'condition' => [
1191 'show_comments' => 'yes'
1192 ],
1193 ]
1194 );
1195
1196 $this->add_control(
1197 'comments_color',
1198 [
1199 'label' => esc_html__('Color', 'ultimate-post-kit'),
1200 'type' => Controls_Manager::COLOR,
1201 'selectors' => [
1202 '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-comments' => 'color: {{VALUE}};',
1203 ],
1204 ]
1205 );
1206
1207 $this->add_control(
1208 'comments_hover_color',
1209 [
1210 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
1211 'type' => Controls_Manager::COLOR,
1212 'selectors' => [
1213 '{{WRAPPER}} .upk-ramble-carousel .upk-item:hover .upk-btn-comments-wrap .upk-comments' => 'color: {{VALUE}};',
1214 ],
1215 ]
1216 );
1217
1218 $this->add_group_control(
1219 Group_Control_Typography::get_type(),
1220 [
1221 'name' => 'comments_typography',
1222 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1223 'selector' => '{{WRAPPER}} .upk-ramble-carousel .upk-item .upk-btn-comments-wrap .upk-comments',
1224 ]
1225 );
1226
1227 $this->end_controls_section();
1228
1229 //Navigation Global Controls
1230 $this->register_navigation_style('swiper');
1231 }
1232
1233 /**
1234 * Main query render for this widget
1235 * @param $posts_per_page number item query limit
1236 */
1237 public function query_posts($posts_per_page) {
1238
1239 $default = $this->getGroupControlQueryArgs();
1240 $args = [];
1241 if ($posts_per_page) {
1242 $args['posts_per_page'] = $posts_per_page;
1243 // $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1244 }
1245 $args = array_merge($default, $args);
1246 $this->_query = new WP_Query($args);
1247 }
1248
1249 public function render_post_meta() {
1250 $settings = $this->get_settings_for_display();
1251
1252 if ($settings['show_author_avatar'] or $settings['show_author_name'] or $settings['show_date']) : ?>
1253 <div class="upk-meta">
1254
1255 <?php if ($settings['show_author_avatar']) : ?>
1256 <div class="upk-author-image">
1257 <?php echo get_avatar(get_the_author_meta('ID'), 48); ?>
1258 </div>
1259 <?php endif; ?>
1260
1261 <div class="upk-author-name-date-wrap">
1262
1263 <?php if ($settings['show_author_name']) : ?>
1264 <div class="upk-author-name">
1265 <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"><?php echo esc_html( get_the_author() ); ?></a>
1266 </div>
1267 <?php endif; ?>
1268
1269 <?php if ($settings['show_date'] or $settings['show_reading_time']) : ?>
1270 <div class="upk-date-reading-time upk-flex upk-flex-middle">
1271 <?php if ($settings['show_date'] == 'yes') : ?>
1272 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1273 <?php $this->render_date(); ?>
1274 </div>
1275 <?php endif; ?>
1276
1277 <?php if (_is_upk_pro_activated()) :
1278 if ('yes' === $settings['show_reading_time']) : ?>
1279 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1280 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1281 </div>
1282 <?php endif; ?>
1283 <?php endif; ?>
1284
1285 </div>
1286 <?php endif; ?>
1287
1288 </div>
1289
1290 </div>
1291 <?php endif;
1292 }
1293
1294 public function render_comments($id = 0) {
1295
1296 if (!$this->get_settings('show_comments')) {
1297 return;
1298 }
1299
1300 ?>
1301 <div class="upk-comments">
1302 <?php echo get_comments_number($id) ?>
1303 <?php echo esc_html__('Comments', 'ultimate-post-kit') ?>
1304 </div>
1305 <?php
1306 }
1307
1308 public function render_readmore() {
1309 $settings = $this->get_settings_for_display();
1310
1311 if (!$this->get_settings('show_readmore')) {
1312 return;
1313 }
1314
1315 $animation = ($this->get_settings('readmore_hover_animation')) ? ' elementor-animation-' . $this->get_settings('readmore_hover_animation') : '';
1316
1317 ?>
1318 <a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore <?php echo esc_html($animation); ?>">
1319 <span class="upk-flex upk-flex-middle">
1320 <?php echo esc_html($this->get_settings('readmore_text')); ?>
1321
1322 <?php if ($settings['readmore_icon']['value']) : ?>
1323 <span class="upk-readmore-btn-icon upk-flex-align-<?php echo esc_html($this->get_settings('icon_align')); ?>">
1324
1325 <?php Icons_Manager::render_icon($settings['readmore_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?>
1326
1327 </span>
1328 <?php endif; ?>
1329 </span>
1330 </a>
1331 <?php
1332 }
1333
1334 public function render_header() {
1335 //Global Function
1336 $this->render_header_attribute('ramble');
1337
1338 ?>
1339 <div <?php $this->print_render_attribute_string('carousel'); ?>>
1340 <div class="upk-wrapper">
1341 <div <?php $this->print_render_attribute_string('swiper'); ?>>
1342 <div class="swiper-wrapper">
1343 <?php
1344 }
1345
1346 public function render_post_grid_item($post_id, $image_size, $excerpt_length) {
1347 $settings = $this->get_settings_for_display();
1348
1349 if ('yes' == $settings['global_link']) {
1350
1351 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
1352 }
1353 $this->add_render_attribute('grid-item', 'class', 'upk-item swiper-slide upk-transition-toggle', true);
1354
1355 ?>
1356 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
1357 <div class="upk-img-wrap">
1358 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1359
1360 <div class="upk-content">
1361
1362 <div class="upk-default-show">
1363 <div class="upk-date-cetagory-wrap">
1364 <?php $this->render_date(); ?>
1365 <?php $this->render_category(); ?>
1366 </div>
1367
1368 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1369 </div>
1370
1371 <div class="upk-default-hide">
1372 <?php $this->render_post_meta(); ?>
1373 <?php $this->render_excerpt($excerpt_length); ?>
1374 </div>
1375
1376 </div>
1377 <div class="upk-btn-comments-wrap">
1378 <div class="upk-btn-wrap upk-flex">
1379 <?php $this->render_readmore(); ?>
1380 </div>
1381 <?php $this->render_comments($post_id); ?>
1382 </div>
1383 </div>
1384 </div>
1385 <?php
1386 }
1387
1388 public function render() {
1389 $settings = $this->get_settings_for_display();
1390
1391 $this->query_posts($settings['item_limit']['size']);
1392 $wp_query = $this->get_query();
1393
1394 if (!$wp_query->found_posts) {
1395 return;
1396 }
1397
1398 $this->render_header();
1399
1400 while ($wp_query->have_posts()) {
1401 $wp_query->the_post();
1402 $thumbnail_size = $settings['primary_thumbnail_size'];
1403
1404 $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $settings['excerpt_length']);
1405 }
1406
1407 wp_reset_postdata();
1408
1409 $this->render_footer();
1410 }
1411 }
1412