PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.3
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.3
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-grid / widgets / ramble-grid.php

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

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