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

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