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

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

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