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 / gratis-grid / widgets / gratis-grid.php

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

1,481 lines 42.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\GratisGrid\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Box_Shadow;
7 use Elementor\Group_Control_Typography;
8 use Elementor\Group_Control_Text_Shadow;
9 use Elementor\Group_Control_Image_Size;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Border;
12
13 use UltimatePostKit\Utils;
14
15 use UltimatePostKit\Traits\Global_Widget_Controls;
16 use UltimatePostKit\Traits\Global_Widget_Functions;
17 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
18 use WP_Query;
19
20 if (!defined('ABSPATH')) {
21 exit;
22 } // Exit if accessed directly
23
24 class Gratis_Grid extends Group_Control_Query {
25
26 use Global_Widget_Controls;
27 use Global_Widget_Functions;
28
29 private $_query = null;
30
31 public function get_name()
32 {
33 return 'upk-gratis-grid';
34 }
35
36 public function get_title()
37 {
38 return BDTUPK . esc_html__('Gratis Grid', 'ultimate-post-kit');
39 }
40
41 public function get_icon()
42 {
43 return 'upk-widget-icon upk-icon-gratis-grid';
44 }
45
46 public function get_categories()
47 {
48 return ['ultimate-post-kit'];
49 }
50
51 public function get_keywords()
52 {
53 return ['post', 'grid', 'blog', 'recent', 'news', 'gratis'];
54 }
55
56 public function get_style_depends()
57 {
58 if ($this->upk_is_edit_mode()) {
59 return ['upk-all-styles'];
60 } else {
61 return ['upk-font', 'upk-gratis-grid'];
62 }
63 }
64
65 public function get_script_depends() {
66 if ($this->upk_is_edit_mode()) {
67 return ['upk-all-scripts'];
68 } else {
69 return ['upk-ajax-loadmore'];
70 }
71 }
72
73 public function get_custom_help_url() {
74 return 'https://youtu.be/jLBLAqxEOwQ';
75 }
76
77 public function get_query()
78 {
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') . BDTUPK_PC,
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 'selectors' => [
112 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap' => 'grid-template-columns: repeat({{SIZE}}, 1fr);',
113 ],
114 'classes' => BDTUPK_IS_PC
115 ]
116 );
117
118 $this->add_responsive_control(
119 'row_gap',
120 [
121 'label' => esc_html__('Row Gap', 'ultimate-post-kit'),
122 'type' => Controls_Manager::SLIDER,
123 'selectors' => [
124 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap' => 'grid-row-gap: {{SIZE}}{{UNIT}};',
125 ]
126 ]
127 );
128
129 $this->add_responsive_control(
130 'column_gap',
131 [
132 'label' => esc_html__('Column Gap', 'ultimate-post-kit'),
133 'type' => Controls_Manager::SLIDER,
134 'selectors' => [
135 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
136 ]
137 ]
138 );
139
140 // item height control
141 $this->add_responsive_control(
142 'item_height',
143 [
144 'label' => __('Item Height', 'ultimate-post-kit'),
145 'type' => Controls_Manager::SLIDER,
146 'default' => [
147 'size' => 400,
148 ],
149 'range' => [
150 'px' => [
151 'min' => 100,
152 'max' => 1000,
153 ],
154 ],
155 'selectors' => [
156 '{{WRAPPER}} .upk-img-wrap' => 'height: {{SIZE}}{{UNIT}};',
157 ],
158 ],
159 );
160
161 $this->add_group_control(
162 Group_Control_Image_Size::get_type(),
163 [
164 'name' => 'primary_thumbnail',
165 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
166 'exclude' => ['custom'],
167 'default' => 'medium',
168 ]
169 );
170
171 $this->add_control(
172 'active_item',
173 [
174 'label' => __('Active Item', 'ultimate-post-kit') . BDTUPK_PC,
175 'type' => Controls_Manager::NUMBER,
176 'default' => 2,
177 'description' => __('Be more creative with your design by typing in your item number.', 'ultimate-post-kit'),
178 'separator' => 'before',
179 'classes' => BDTUPK_IS_PC,
180 ]
181 );
182
183 $this->end_controls_section();
184
185 //New Query Builder Settings
186 $this->start_controls_section(
187 'section_post_query_builder',
188 [
189 'label' => __('Query', 'ultimate-post-kit'),
190 'tab' => Controls_Manager::TAB_CONTENT,
191 ]
192 );
193
194 $this->add_control(
195 'item_limit',
196 [
197 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
198 'type' => Controls_Manager::SLIDER,
199 'range' => [
200 'px' => [
201 'min' => 1,
202 'max' => 20,
203 ],
204 ],
205 'default' => [
206 'size' => 6,
207 ],
208 'condition' => [
209 'posts_source!' => 'current_query',
210 ]
211 ]
212 );
213
214 $this->register_query_builder_controls();
215
216 $this->end_controls_section();
217
218 $this->start_controls_section(
219 'section_content_additional',
220 [
221 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
222 ]
223 );
224
225 //Global Title Controls
226 $this->register_title_controls();
227
228 $this->add_control(
229 'show_category',
230 [
231 'label' => esc_html__('Show Category', 'ultimate-post-kit'),
232 'type' => Controls_Manager::SWITCHER,
233 'default' => 'yes',
234 ]
235 );
236
237 $this->add_control(
238 'show_meta',
239 [
240 'label' => esc_html__('Show Meta', 'ultimate-post-kit'),
241 'type' => Controls_Manager::SWITCHER,
242 'default' => 'yes',
243 'separator' => 'before'
244 ]
245 );
246
247 $this->add_control(
248 'show_readmore',
249 [
250 'label' => esc_html__('Read more', 'ultimate-post-kit'),
251 'type' => Controls_Manager::SWITCHER,
252 'default' => 'yes',
253 'separator' => 'before'
254 ]
255 );
256
257 $this->add_control(
258 'readmore_text',
259 [
260 'label' => __('Read More Text', 'ultimate-post-kit'),
261 'type' => Controls_Manager::TEXT,
262 'dynamic' => [ 'active' => true ],
263 'default' => esc_html__('Explore', 'ultimate-post-kit'),
264 'label_block' => false,
265 'condition' => [
266 'show_readmore' => 'yes'
267 ]
268 ]
269 );
270 //Global Date Controls
271 $this->register_date_controls();
272
273 //Global Reading Time Controls
274 $this->register_reading_time_controls();
275
276 $this->add_control(
277 'meta_separator',
278 [
279 'label' => __('Separator', 'ultimate-post-kit'),
280 'type' => Controls_Manager::TEXT,
281 'default' => '/',
282 'label_block' => false,
283 ]
284 );
285
286 $this->add_control(
287 'item_match_height',
288 [
289 'label' => __('Item Match Height', 'ultimate-post-kit'),
290 'type' => Controls_Manager::SWITCHER,
291 'default' => 'yes',
292 'prefix_class' => 'upk-item-match-height--',
293 'separator' => 'before'
294 ]
295 );
296
297 $this->add_control(
298 'show_pagination',
299 [
300 'label' => esc_html__('Show Pagination', 'ultimate-post-kit'),
301 'type' => Controls_Manager::SWITCHER,
302 'separator' => 'before'
303 ]
304 );
305
306 //Global Ajax Controls
307 $this->register_ajax_loadmore_controls();
308
309 $this->add_control(
310 'global_link',
311 [
312 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
313 'type' => Controls_Manager::SWITCHER,
314 'prefix_class' => 'upk-global-link-',
315 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
316 ]
317 );
318
319 $this->end_controls_section();
320
321 //Style
322 $this->start_controls_section(
323 'upk_section_style',
324 [
325 'label' => esc_html__('Items', 'ultimate-post-kit'),
326 'tab' => Controls_Manager::TAB_STYLE,
327 ]
328 );
329
330 $this->start_controls_tabs('tabs_item_style');
331
332 $this->start_controls_tab(
333 'tab_item_normal',
334 [
335 'label' => esc_html__('Normal', 'ultimate-post-kit'),
336 ]
337 );
338
339 $this->add_control(
340 'overlay_type',
341 [
342 'label' => esc_html__('Overlay', 'ultimate-post-kit'),
343 'type' => Controls_Manager::SELECT,
344 'default' => 'background',
345 'options' => [
346 'none' => esc_html__('None', 'ultimate-post-kit'),
347 'background' => esc_html__('Background', 'ultimate-post-kit'),
348 'blend' => esc_html__('Blend', 'ultimate-post-kit'),
349 ],
350 ]
351 );
352
353 $this->add_group_control(
354 Group_Control_Background::get_type(),
355 [
356 'name' => 'overlay_color',
357 'label' => esc_html__('Background', 'ultimate-post-kit'),
358 'types' => ['classic', 'gradient'],
359 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
360 'exclude' => ['image'],
361 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-img-wrap::before',
362 'fields_options' => [
363 'background' => [
364 'default' => 'classic',
365 ],
366 'color' => [
367 'default' => '#fff',
368 ],
369 ],
370 'condition' => [
371 'overlay_type' => ['background', 'blend'],
372 ],
373 ]
374 );
375
376 $this->add_control(
377 'blend_type',
378 [
379 'label' => esc_html__('Blend Type', 'ultimate-post-kit'),
380 'type' => Controls_Manager::SELECT,
381 'default' => 'multiply',
382 'options' => ultimate_post_kit_blend_options(),
383 'condition' => [
384 'overlay_type' => 'blend',
385 ],
386 'selectors' => [
387 '{{WRAPPER}} .upk-gratis-grid .upk-img-wrap::before' => 'mix-blend-mode: {{VALUE}};'
388 ],
389 ]
390 );
391
392 //border
393 $this->add_group_control(
394 Group_Control_Border::get_type(),
395 [
396 'name' => 'item_border',
397 'label' => esc_html__('Border', 'ultimate-post-kit'),
398 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item',
399 'separator' => 'before'
400 ]
401 );
402 //border radius
403 $this->add_responsive_control(
404 'item_border_radius',
405 [
406 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
407 'type' => Controls_Manager::DIMENSIONS,
408 'size_units' => ['px', '%'],
409 'selectors' => [
410 '{{WRAPPER}} .upk-gratis-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
411 ],
412 ]
413 );
414 //padding
415 $this->add_responsive_control(
416 'item_padding',
417 [
418 'label' => esc_html__('Padding', 'ultimate-post-kit'),
419 'type' => Controls_Manager::DIMENSIONS,
420 'size_units' => ['px', '%'],
421 'selectors' => [
422 '{{WRAPPER}} .upk-gratis-grid .upk-content-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
423 ],
424 ]
425 );
426 //box shadow
427 $this->add_group_control(
428 Group_Control_Box_Shadow::get_type(),
429 [
430 'name' => 'item_box_shadow',
431 'label' => esc_html__('Box Shadow', 'ultimate-post-kit'),
432 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item',
433 ]
434 );
435
436
437 $this->end_controls_tab();
438 $this->start_controls_tab(
439 'tab_item_hover',
440 [
441 'label' => esc_html__('Hover', 'ultimate-post-kit'),
442 ]
443 );
444 $this->add_group_control(
445 Group_Control_Background::get_type(),
446 [
447 'name' => 'overlay_hover_color',
448 'label' => esc_html__('Background', 'ultimate-post-kit'),
449 'types' => ['classic', 'gradient'],
450 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
451 'exclude' => ['image'],
452 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-img-wrap::after',
453 'fields_options' => [
454 'background' => [
455 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
456 'default' => 'gradient',
457 ],
458 'color' => [
459 'default' => 'rgba(32, 34, 37, 0.81)',
460 ],
461 'color_b' => [
462 'default' => 'rgba(0, 0, 0, 0)',
463 ],
464 'gradient_type' => [
465 'default' => 'linear',
466 ],
467 'gradient_angle' => [
468 'default' => [
469 'unit' => 'deg',
470 'size' => 25,
471 ],
472 ],
473 ],
474 ]
475 );
476 //border color
477 $this->add_control(
478 'item_border_color_hover',
479 [
480 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
481 'type' => Controls_Manager::COLOR,
482 'selectors' => [
483 '{{WRAPPER}} .upk-gratis-grid .upk-item:hover' => 'border-color: {{VALUE}};',
484 ],
485 'condition' => [
486 'item_border_border!' => '',
487 ],
488 ]
489 );
490 //box shadow
491 $this->add_group_control(
492 Group_Control_Box_Shadow::get_type(),
493 [
494 'name' => 'item_box_shadow_hover',
495 'label' => esc_html__('Box Shadow', 'ultimate-post-kit'),
496 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item:hover',
497 ]
498 );
499
500 $this->end_controls_tab();
501 $this->start_controls_tab(
502 'tab_item_active',
503 [
504 'label' => esc_html__('Active', 'ultimate-post-kit'),
505 ]
506 );
507 $this->add_group_control(
508 Group_Control_Background::get_type(),
509 [
510 'name' => 'overlay_active_color',
511 'label' => esc_html__('Background', 'ultimate-post-kit'),
512 'types' => ['classic', 'gradient'],
513 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
514 'exclude' => ['image'],
515 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-img-wrap::after',
516 ]
517 );
518 //border color
519 $this->add_control(
520 'item_border_color_active',
521 [
522 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
523 'type' => Controls_Manager::COLOR,
524 'selectors' => [
525 '{{WRAPPER}} .upk-gratis-grid .upk-item.active' => 'border-color: {{VALUE}};',
526 ],
527 'condition' => [
528 'item_border_border!' => '',
529 ],
530 'separator' => 'before'
531 ]
532 );
533 //box shadow
534 $this->add_group_control(
535 Group_Control_Box_Shadow::get_type(),
536 [
537 'name' => 'item_box_shadow_active',
538 'label' => esc_html__('Box Shadow', 'ultimate-post-kit'),
539 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item.active',
540 ]
541 );
542 $this->end_controls_tab();
543 $this->end_controls_tabs();
544
545 $this->end_controls_section();
546
547 $this->start_controls_section(
548 'section_style_title',
549 [
550 'label' => esc_html__('Title', 'ultimate-post-kit'),
551 'tab' => Controls_Manager::TAB_STYLE,
552 'condition' => [
553 'show_title' => 'yes',
554 ],
555 ]
556 );
557
558 $this->add_control(
559 'title_style',
560 [
561 'label' => esc_html__('Style', 'ultimate-post-kit'),
562 'type' => Controls_Manager::SELECT,
563 'default' => 'underline',
564 'options' => [
565 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
566 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
567 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
568 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
569 ],
570 ]
571 );
572
573 $this->add_control(
574 'title_color',
575 [
576 'label' => esc_html__('Color', 'ultimate-post-kit'),
577 'type' => Controls_Manager::COLOR,
578 'selectors' => [
579 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap .upk-title a' => 'color: {{VALUE}};',
580 ],
581 'separator' => 'before'
582 ]
583 );
584
585 $this->add_control(
586 'title_hover_color',
587 [
588 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
589 'type' => Controls_Manager::COLOR,
590 'selectors' => [
591 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap .upk-item.active .upk-title a:hover, {{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap .upk-item:hover .upk-title a:hover' => 'color: {{VALUE}};',
592 ],
593 ]
594 );
595
596 $this->add_control(
597 'title_item_hover_color',
598 [
599 'label' => esc_html__('Item Hover & Active Color', 'ultimate-post-kit'),
600 'type' => Controls_Manager::COLOR,
601 'selectors' => [
602 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap .upk-item.active .upk-title a, {{WRAPPER}} .upk-gratis-grid .upk-gratis-wrap .upk-item:hover .upk-title a' => 'color: {{VALUE}};',
603 ],
604 ]
605 );
606
607 //margin
608 $this->add_responsive_control(
609 'title_margin',
610 [
611 'label' => esc_html__('Margin', 'ultimate-post-kit'),
612 'type' => Controls_Manager::DIMENSIONS,
613 'size_units' => ['px', '%', 'em'],
614 'selectors' => [
615 '{{WRAPPER}} .upk-gratis-grid .upk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
616 ],
617 'separator' => 'before'
618 ]
619 );
620
621 $this->add_group_control(
622 Group_Control_Typography::get_type(),
623 [
624 'name' => 'title_typography',
625 'label' => esc_html__('Typography', 'ultimate-post-kit'),
626 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-title',
627 ]
628 );
629
630 $this->add_group_control(
631 Group_Control_Text_Shadow::get_type(),
632 [
633 'name' => 'title_text_shadow',
634 'label' => __('Text Shadow', 'ultimate-post-kit'),
635 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-title',
636 ]
637 );
638
639 $this->end_controls_section();
640
641 $this->start_controls_section(
642 'section_style_meta',
643 [
644 'label' => esc_html__('Meta', 'ultimate-post-kit'),
645 'tab' => Controls_Manager::TAB_STYLE,
646 'condition' => [
647 'show_meta' => 'yes',
648 ],
649 ]
650 );
651
652 $this->add_control(
653 'meta_color',
654 [
655 'label' => esc_html__('Color', 'ultimate-post-kit'),
656 'type' => Controls_Manager::COLOR,
657 'selectors' => [
658 '{{WRAPPER}} .upk-gratis-grid .upk-meta, {{WRAPPER}} .upk-gratis-grid .upk-author-name' => 'color: {{VALUE}};',
659 ],
660 ]
661 );
662
663 $this->add_control(
664 'meta_hover_color',
665 [
666 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
667 'type' => Controls_Manager::COLOR,
668 'selectors' => [
669 '{{WRAPPER}} .upk-gratis-grid .upk-author-name:hover' => 'color: {{VALUE}};',
670 ],
671 ]
672 );
673
674 $this->add_control(
675 'meta_item_hover_active_color',
676 [
677 'label' => esc_html__('Item Hover & Active Color', 'ultimate-post-kit'),
678 'type' => Controls_Manager::COLOR,
679 'selectors' => [
680 '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-meta, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-meta, {{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-author-name, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-author-name' => 'color: {{VALUE}};',
681 ],
682 ]
683 );
684
685 $this->add_responsive_control(
686 'meta_icon_size',
687 [
688 'label' => esc_html__('Icon Size', 'ultimate-post-kit'),
689 'type' => Controls_Manager::SLIDER,
690 'range' => [
691 'px' => [
692 'min' => 0,
693 'max' => 50,
694 ],
695 ],
696 'selectors' => [
697 '{{WRAPPER}} .upk-gratis-grid .upk-meta svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
698 ],
699 'separator' => 'before'
700 ]
701 );
702
703 $this->add_responsive_control(
704 'meta_space_between',
705 [
706 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
707 'type' => Controls_Manager::SLIDER,
708 'range' => [
709 'px' => [
710 'min' => 0,
711 'max' => 50,
712 ],
713 ],
714 'selectors' => [
715 '{{WRAPPER}} .upk-gratis-grid .upk-meta' => 'gap: {{SIZE}}{{UNIT}};',
716 ],
717 ]
718 );
719
720 $this->add_group_control(
721 Group_Control_Typography::get_type(),
722 [
723 'name' => 'meta_typography',
724 'label' => esc_html__('Typography', 'ultimate-post-kit'),
725 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-meta',
726 ]
727 );
728
729 $this->add_control(
730 'line_heading',
731 [
732 'label' => __('LINE', 'ultimate-post-kit'),
733 'type' => Controls_Manager::HEADING,
734 'separator' => 'before'
735 ]
736 );
737
738 $this->add_responsive_control(
739 'meta_line_height_size',
740 [
741 'label' => esc_html__('Line Height', 'ultimate-post-kit'),
742 'type' => Controls_Manager::SLIDER,
743 'range' => [
744 'px' => [
745 'min' => 0,
746 'max' => 50,
747 ],
748 ],
749 'selectors' => [
750 '{{WRAPPER}} .upk-gratis-line' => 'height: {{SIZE}}{{UNIT}};',
751 ],
752 ]
753 );
754
755
756 $this->add_control(
757 'line_border_color',
758 [
759 'label' => esc_html__('Line Color', 'ultimate-post-kit'),
760 'type' => Controls_Manager::COLOR,
761 'selectors' => [
762 '{{WRAPPER}} .upk-gratis-line' => 'background-color: {{VALUE}};',
763 ],
764 ]
765 );
766
767 $this->add_control(
768 'line_border_hover_active_color',
769 [
770 'label' => esc_html__('Hover / Active Line Color', 'ultimate-post-kit'),
771 'type' => Controls_Manager::COLOR,
772 'selectors' => [
773 '{{WRAPPER}} .upk-item.active .upk-gratis-line, {{WRAPPER}} .upk-item:hover .upk-gratis-line' => 'background-color: {{VALUE}};',
774 ],
775 ]
776 );
777
778 //margin control
779 $this->add_responsive_control(
780 'line_margin',
781 [
782 'label' => esc_html__('Margin', 'ultimate-post-kit'),
783 'type' => Controls_Manager::DIMENSIONS,
784 'size_units' => ['px', '%', 'em'],
785 'selectors' => [
786 '{{WRAPPER}} .upk-gratis-grid .upk-gratis-line' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
787 ],
788 ]
789 );
790
791
792
793 $this->end_controls_section();
794
795 $this->start_controls_section(
796 'section_style_category',
797 [
798 'label' => esc_html__('Category', 'ultimate-post-kit'),
799 'tab' => Controls_Manager::TAB_STYLE,
800 'condition' => [
801 'show_category' => 'yes',
802 ],
803 ]
804 );
805
806 $this->start_controls_tabs('tabs_category_style');
807
808 $this->start_controls_tab(
809 'tab_category_normal',
810 [
811 'label' => esc_html__('Normal', 'ultimate-post-kit'),
812 ]
813 );
814
815 $this->add_control(
816 'category_color',
817 [
818 'label' => esc_html__('Color', 'ultimate-post-kit'),
819 'type' => Controls_Manager::COLOR,
820 'selectors' => [
821 '{{WRAPPER}} .upk-gratis-grid .upk-category a' => 'color: {{VALUE}};',
822 ],
823 ]
824 );
825
826 $this->add_group_control(
827 Group_Control_Background::get_type(),
828 [
829 'name' => 'category_background',
830 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-category a',
831 ]
832 );
833
834 $this->add_group_control(
835 Group_Control_Border::get_type(),
836 [
837 'name' => 'category_border',
838 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-category a',
839 ]
840 );
841
842 $this->add_responsive_control(
843 'category_border_radius',
844 [
845 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
846 'type' => Controls_Manager::DIMENSIONS,
847 'size_units' => ['px', '%'],
848 'selectors' => [
849 '{{WRAPPER}} .upk-gratis-grid .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
850 ],
851 ]
852 );
853
854 $this->add_responsive_control(
855 'category_padding',
856 [
857 'label' => esc_html__('Padding', 'ultimate-post-kit'),
858 'type' => Controls_Manager::DIMENSIONS,
859 'size_units' => ['px', 'em', '%'],
860 'selectors' => [
861 '{{WRAPPER}} .upk-gratis-grid .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
862 ],
863 ]
864 );
865
866 $this->add_responsive_control(
867 'category_spacing',
868 [
869 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
870 'type' => Controls_Manager::SLIDER,
871 'range' => [
872 'px' => [
873 'min' => 0,
874 'max' => 50,
875 'step' => 2,
876 ],
877 ],
878 'selectors' => [
879 '{{WRAPPER}} .upk-gratis-grid .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
880 ],
881 ]
882 );
883
884 $this->add_group_control(
885 Group_Control_Box_Shadow::get_type(),
886 [
887 'name' => 'category_shadow',
888 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-category a',
889 ]
890 );
891
892 $this->add_group_control(
893 Group_Control_Typography::get_type(),
894 [
895 'name' => 'category_typography',
896 'label' => esc_html__('Typography', 'ultimate-post-kit'),
897 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-category a',
898 ]
899 );
900
901 $this->end_controls_tab();
902
903 $this->start_controls_tab(
904 'tab_category_hover',
905 [
906 'label' => esc_html__('Hover', 'ultimate-post-kit'),
907 ]
908 );
909
910 $this->add_control(
911 'category_hover_color',
912 [
913 'label' => esc_html__('Color', 'ultimate-post-kit'),
914 'type' => Controls_Manager::COLOR,
915 'selectors' => [
916 '{{WRAPPER}} .upk-gratis-grid .upk-category a:hover' => 'color: {{VALUE}};',
917 ],
918 ]
919 );
920
921 $this->add_group_control(
922 Group_Control_Background::get_type(),
923 [
924 'name' => 'category_hover_background',
925 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-category a:hover',
926 ]
927 );
928
929 $this->add_control(
930 'category_hover_border_color',
931 [
932 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
933 'type' => Controls_Manager::COLOR,
934 'condition' => [
935 'category_border_border!' => '',
936 ],
937 'selectors' => [
938 '{{WRAPPER}} .upk-gratis-grid .upk-category a:hover' => 'border-color: {{VALUE}};',
939 ],
940 ]
941 );
942
943 $this->end_controls_tab();
944
945 $this->start_controls_tab(
946 'tab_category_item_hover',
947 [
948 'label' => esc_html__('Item Hover & Active', 'ultimate-post-kit'),
949 ]
950 );
951
952 $this->add_control(
953 'category_item_hover_color',
954 [
955 'label' => esc_html__('Color', 'ultimate-post-kit'),
956 'type' => Controls_Manager::COLOR,
957 'selectors' => [
958 '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-category a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-category a' => 'color: {{VALUE}};',
959 ],
960 ]
961 );
962
963 $this->add_group_control(
964 Group_Control_Background::get_type(),
965 [
966 'name' => 'category_hover_item_background',
967 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-category a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-category a',
968 ]
969 );
970
971 $this->add_control(
972 'category_item_hover_border_color',
973 [
974 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
975 'type' => Controls_Manager::COLOR,
976 'condition' => [
977 'category_border_border!' => '',
978 ],
979 'selectors' => [
980 '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-category a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-category a' => 'border-color: {{VALUE}};',
981 ],
982 ]
983 );
984
985 $this->end_controls_tab();
986
987 $this->end_controls_tabs();
988
989 $this->end_controls_section();
990
991 $this->start_controls_section(
992 'section_style_link_button',
993 [
994 'label' => esc_html__('Read More', 'ultimate-post-kit'),
995 'tab' => Controls_Manager::TAB_STYLE,
996 'condition' => [
997 'show_readmore' => 'yes',
998 ],
999 ]
1000 );
1001
1002 $this->start_controls_tabs('tabs_link_button_style');
1003
1004 $this->start_controls_tab(
1005 'tab_link_button_normal',
1006 [
1007 'label' => esc_html__('Normal', 'ultimate-post-kit'),
1008 ]
1009 );
1010
1011 $this->add_control(
1012 'link_button_color',
1013 [
1014 'label' => esc_html__('Color', 'ultimate-post-kit'),
1015 'type' => Controls_Manager::COLOR,
1016 'selectors' => [
1017 '{{WRAPPER}} .upk-gratis-grid .upk-link-button a' => 'color: {{VALUE}};',
1018 ],
1019 ]
1020 );
1021
1022 $this->add_group_control(
1023 Group_Control_Background::get_type(),
1024 [
1025 'name' => 'link_button_background',
1026 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-link-button a',
1027 ]
1028 );
1029
1030 $this->add_group_control(
1031 Group_Control_Border::get_type(),
1032 [
1033 'name' => 'link_button_border',
1034 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-link-button a',
1035 ]
1036 );
1037
1038 $this->add_responsive_control(
1039 'link_button_border_radius',
1040 [
1041 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
1042 'type' => Controls_Manager::DIMENSIONS,
1043 'size_units' => ['px', '%'],
1044 'selectors' => [
1045 '{{WRAPPER}} .upk-gratis-grid .upk-link-button a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1046 ],
1047 ]
1048 );
1049
1050 $this->add_responsive_control(
1051 'link_button_padding',
1052 [
1053 'label' => esc_html__('Padding', 'ultimate-post-kit'),
1054 'type' => Controls_Manager::DIMENSIONS,
1055 'size_units' => ['px', 'em', '%'],
1056 'selectors' => [
1057 '{{WRAPPER}} .upk-gratis-grid .upk-link-button a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1058 ],
1059 ]
1060 );
1061
1062 $this->add_group_control(
1063 Group_Control_Box_Shadow::get_type(),
1064 [
1065 'name' => 'link_button_shadow',
1066 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-link-button a',
1067 ]
1068 );
1069
1070 $this->add_group_control(
1071 Group_Control_Typography::get_type(),
1072 [
1073 'name' => 'link_button_typography',
1074 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1075 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-link-button a',
1076 ]
1077 );
1078
1079 $this->end_controls_tab();
1080
1081 $this->start_controls_tab(
1082 'tab_link_button_hover',
1083 [
1084 'label' => esc_html__('Hover', 'ultimate-post-kit'),
1085 ]
1086 );
1087
1088 $this->add_control(
1089 'link_button_hover_color',
1090 [
1091 'label' => esc_html__('Color', 'ultimate-post-kit'),
1092 'type' => Controls_Manager::COLOR,
1093 'selectors' => [
1094 '{{WRAPPER}} .upk-gratis-grid .upk-item .upk-link-button a:hover' => 'color: {{VALUE}};',
1095 ],
1096 ]
1097 );
1098
1099 $this->add_group_control(
1100 Group_Control_Background::get_type(),
1101 [
1102 'name' => 'link_button_hover_background',
1103 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item .upk-link-button a::before',
1104 ]
1105 );
1106
1107 $this->add_control(
1108 'link_button_hover_border_color',
1109 [
1110 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1111 'type' => Controls_Manager::COLOR,
1112 'condition' => [
1113 'link_button_border_border!' => '',
1114 ],
1115 'selectors' => [
1116 '{{WRAPPER}} .upk-gratis-grid .upk-item .upk-link-button a:hover' => 'border-color: {{VALUE}};',
1117 ],
1118 ]
1119 );
1120
1121 $this->end_controls_tab();
1122
1123 $this->start_controls_tab(
1124 'tab_link_button_item_hover',
1125 [
1126 'label' => esc_html__('Item Hover & Active', 'ultimate-post-kit'),
1127 ]
1128 );
1129
1130 $this->add_control(
1131 'link_button_item_hover_color',
1132 [
1133 'label' => esc_html__('Color', 'ultimate-post-kit'),
1134 'type' => Controls_Manager::COLOR,
1135 'selectors' => [
1136 '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-link-button a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-link-button a' => 'color: {{VALUE}};',
1137 ],
1138 ]
1139 );
1140
1141 $this->add_group_control(
1142 Group_Control_Background::get_type(),
1143 [
1144 'name' => 'link_button_item_hover_background',
1145 'selector' => '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-link-button a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-link-button a',
1146 ]
1147 );
1148
1149 $this->add_control(
1150 'link_button_item_hover_border_color',
1151 [
1152 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1153 'type' => Controls_Manager::COLOR,
1154 'condition' => [
1155 'link_button_border_border!' => '',
1156 ],
1157 'selectors' => [
1158 '{{WRAPPER}} .upk-gratis-grid .upk-item.active .upk-link-button a, {{WRAPPER}} .upk-gratis-grid .upk-item:hover .upk-link-button a' => 'border-color: {{VALUE}};',
1159 ],
1160 ]
1161 );
1162
1163 $this->end_controls_tab();
1164
1165 $this->end_controls_tabs();
1166
1167 $this->end_controls_section();
1168
1169 //Global ajax style controls
1170 $this->register_ajax_loadmore_style_controls();
1171 }
1172
1173 /**
1174 * Get post query builder arguments
1175 */
1176 public function query_posts( $posts_per_page ) {
1177 $settings = $this->get_settings();
1178 $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1179 $args = $this->getGroupControlQueryArgs();
1180 $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1181
1182 if ( $is_current_query ) {
1183 unset( $args['offset'] );
1184 unset( $args['no_found_rows'] );
1185 $posts_per_page = 0;
1186 }
1187
1188 if ( $posts_per_page > 0 ) {
1189 $args['posts_per_page'] = $posts_per_page;
1190 } else {
1191 $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1192 }
1193
1194 if ( $settings['show_pagination'] ) {
1195 $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1196 }
1197
1198 $this->_query = new \WP_Query( $args );
1199 }
1200
1201 public function render_image($image_id, $size)
1202 {
1203 $placeholder_image_src = Utils::get_placeholder_image_src();
1204
1205 $image_src = wp_get_attachment_image_src($image_id, $size);
1206
1207 if (!$image_src) {
1208 $image_src = $placeholder_image_src;
1209 } else {
1210 $image_src = $image_src[0];
1211 }
1212
1213 ?>
1214
1215 <img class="upk-img" src="<?php echo esc_url($image_src); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
1216
1217 <?php
1218 }
1219
1220 public function render_category()
1221 {
1222
1223 if (!$this->get_settings('show_category')) {
1224 return;
1225 }
1226 ?>
1227 <div class="upk-category">
1228 <?php echo wp_kses_post( upk_get_category($this->get_settings('posts_source')) ); ?>
1229 </div>
1230 <?php
1231 }
1232
1233 public function render_date()
1234 {
1235 $settings = $this->get_settings_for_display();
1236
1237
1238 if (!$this->get_settings('show_date')) {
1239 return;
1240 }
1241
1242 ?>
1243 <div class="upk-date">
1244 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-calendar" viewBox="0 0 16 16">
1245 <path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z" />
1246 </svg>
1247 <?php if ($settings['human_diff_time'] == 'yes') {
1248 echo esc_html( ultimate_post_kit_post_time_diff( ( $settings['human_diff_time_short'] == 'yes' ) ? 'short' : '' ) );
1249 } else {
1250 echo get_the_date();
1251 } ?>
1252 </div>
1253
1254 <?php if ($settings['show_time']) : ?>
1255 <div class="upk-post-time">
1256 <i class="upk-icon-clock" aria-hidden="true"></i>
1257 <?php echo esc_html( get_the_time() ); ?>
1258 </div>
1259 <?php endif; ?>
1260
1261 <?php
1262 }
1263
1264 public function render_author()
1265 {
1266
1267 if (!$this->get_settings('show_meta')) {
1268 return;
1269 }
1270 ?>
1271
1272 <div class="upk-author">
1273 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-circle" viewBox="0 0 16 16">
1274 <path d="M11 6a3 3 0 1 1-6 0 3 3 0 0 1 6 0z" />
1275 <path fill-rule="evenodd" d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm8-7a7 7 0 0 0-5.468 11.37C3.242 11.226 4.805 10 8 10s4.757 1.225 5.468 2.37A7 7 0 0 0 8 1z" />
1276 </svg>
1277 <span><?php echo esc_html__('by', 'ultimate-post-kit') ?></span>
1278 <a
1279 class="upk-author-name"
1280 href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"
1281 aria-label="<?php
1282 /* translators: %s: author name */
1283 echo esc_attr( sprintf( __( 'View all posts by %s', 'ultimate-post-kit' ), get_the_author() ) );
1284 ?>"
1285 >
1286 <span><?php echo esc_html( get_the_author() ); ?></span>
1287 </a>
1288 </div>
1289
1290
1291 <?php
1292 }
1293
1294 public function render_post_grid_item($post_id, $image_size, $active_item) {
1295 $settings = $this->get_settings_for_display();
1296
1297 if ('yes' == $settings['global_link']) {
1298
1299 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
1300 }
1301
1302 $this->add_render_attribute('grid-item', 'class', 'upk-item ' . $active_item, true);
1303
1304 ?>
1305 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
1306 <div class="upk-img-wrap">
1307 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1308 </div>
1309
1310 <div class="upk-content-wrap">
1311 <?php $this->render_category(); ?>
1312 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1313
1314 <?php if ($settings['show_meta']) : ?>
1315 <div class="upk-meta">
1316 <?php $this->render_author(); ?>
1317 <?php if ($settings['show_date'] or $settings['show_reading_time']) : ?>
1318 <div class="upk-date-reading upk-flex upk-flex-middle">
1319 <?php $this->render_date(); ?>
1320 <?php if ('yes' === $settings['show_reading_time']) : ?>
1321 <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1322 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1323 </div>
1324 <?php endif; ?>
1325 </div>
1326 <?php endif; ?>
1327 </div>
1328 <?php endif; ?>
1329
1330 <div class="upk-gratis-line"></div>
1331
1332 <?php if ($settings['show_readmore'] === 'yes' and !empty($settings['readmore_text'])) : ?>
1333 <div class="upk-link-button">
1334 <a href="<?php echo esc_url(get_permalink()); ?>">
1335 <span><?php echo esc_html($settings['readmore_text']); ?></span>
1336 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-right" viewBox="0 0 16 16">
1337 <path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z" />
1338 </svg>
1339 </a>
1340 </div>
1341 <?php endif; ?>
1342 </div>
1343 </div>
1344
1345 <?php
1346 }
1347
1348 public function render() {
1349 $settings = $this->get_settings_for_display();
1350
1351 $this->query_posts($settings['item_limit']['size']);
1352
1353 $wp_query = $this->get_query();
1354
1355 if (!$wp_query->found_posts) {
1356 return;
1357 }
1358
1359 $this->add_render_attribute('grid-wrap', 'class', 'upk-gratis-wrap upk-ajax-grid-wrap');
1360
1361 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
1362 $this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation');
1363 if (isset($settings['upk_in_animation_delay']['size'])) {
1364 $this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']);
1365 }
1366 }
1367
1368 $this->add_render_attribute(
1369 [
1370 'upk-gratis-grid' => [
1371 'class' => 'upk-gratis-grid upk-ajax-grid',
1372 'data-loadmore' => [
1373 wp_json_encode(
1374 array_filter(
1375 [
1376 'loadmore_enable' => $settings['ajax_loadmore_enable'],
1377 'loadmore_btn' => $settings['ajax_loadmore_btn'],
1378 'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'],
1379 ]
1380 )
1381 ),
1382 ],
1383 ],
1384 ]
1385 );
1386
1387 if ( $settings['ajax_loadmore_enable'] == 'yes' ) {
1388 $ajax_settings = [
1389 'posts_source' => isset( $settings['posts_source'] ) ? $settings['posts_source'] : 'post',
1390 'posts_per_page' => isset( $settings['item_limit']['size'] ) ? $settings['item_limit']['size'] : 6,
1391 'ajax_item_load' => isset( $settings['ajax_loadmore_items'] ) ? $settings['ajax_loadmore_items'] : 3,
1392 'posts_selected_ids' => isset( $settings['posts_selected_ids'] ) ? $settings['posts_selected_ids'] : '',
1393 'posts_include_by' => isset( $settings['posts_include_by'] ) ? $settings['posts_include_by'] : [],
1394 'posts_include_author_ids' => isset( $settings['posts_include_author_ids'] ) ? $settings['posts_include_author_ids'] : '',
1395 'posts_include_term_ids' => isset( $settings['posts_include_term_ids'] ) ? $settings['posts_include_term_ids'] : '',
1396 'posts_exclude_by' => isset( $settings['posts_exclude_by'] ) ? $settings['posts_exclude_by'] : [],
1397 'posts_exclude_ids' => isset( $settings['posts_exclude_ids'] ) ? $settings['posts_exclude_ids'] : '',
1398 'posts_exclude_author_ids' => isset( $settings['posts_exclude_author_ids'] ) ? $settings['posts_exclude_author_ids'] : '',
1399 'posts_exclude_term_ids' => isset( $settings['posts_exclude_term_ids'] ) ? $settings['posts_exclude_term_ids'] : '',
1400 'posts_offset' => isset( $settings['posts_offset'] ) ? $settings['posts_offset'] : 0,
1401 'posts_select_date' => isset( $settings['posts_select_date'] ) ? $settings['posts_select_date'] : '',
1402 'posts_date_before' => isset( $settings['posts_date_before'] ) ? $settings['posts_date_before'] : '',
1403 'posts_date_after' => isset( $settings['posts_date_after'] ) ? $settings['posts_date_after'] : '',
1404 'posts_orderby' => isset( $settings['posts_orderby'] ) ? $settings['posts_orderby'] : 'date',
1405 'posts_order' => isset( $settings['posts_order'] ) ? $settings['posts_order'] : 'DESC',
1406 'posts_ignore_sticky_posts' => isset( $settings['posts_ignore_sticky_posts'] ) ? $settings['posts_ignore_sticky_posts'] : 'no',
1407 'posts_only_with_featured_image' => isset( $settings['posts_only_with_featured_image'] ) ? $settings['posts_only_with_featured_image'] : 'no',
1408 // Grid Settings
1409 'show_title' => isset( $settings['show_title'] ) ? $settings['show_title'] : 'yes',
1410 'title_tags' => isset( $settings['title_tags'] ) ? $settings['title_tags'] : 'h3',
1411 'show_meta' => isset( $settings['show_meta'] ) ? $settings['show_meta'] : 'yes',
1412 'show_author' => isset( $settings['show_author'] ) ? $settings['show_author'] : 'yes',
1413 'show_date' => isset( $settings['show_date'] ) ? $settings['show_date'] : 'yes',
1414 'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no',
1415 'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no',
1416 'show_time' => isset( $settings['show_time'] ) ? $settings['show_time'] : '',
1417 'show_category' => isset( $settings['show_category'] ) ? $settings['show_category'] : 'yes',
1418 'show_readmore' => isset( $settings['show_readmore'] ) ? $settings['show_readmore'] : 'yes',
1419 'readmore_text' => isset( $settings['readmore_text'] ) ? $settings['readmore_text'] : '',
1420 'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no',
1421 'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200,
1422 'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no',
1423 'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no',
1424 'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '/',
1425 'primary_thumbnail_size' => isset( $settings['primary_thumbnail_size'] ) ? $settings['primary_thumbnail_size'] : 'full',
1426 'title_style' => isset( $settings['title_style'] ) ? $settings['title_style'] : 'underline',
1427 'upk_link_new_tab' => isset( $settings['upk_link_new_tab'] ) ? $settings['upk_link_new_tab'] : 'no',
1428 'global_link' => isset( $settings['global_link'] ) ? $settings['global_link'] : 'no',
1429 ];
1430
1431 $this->add_render_attribute(
1432 [
1433 'upk-gratis-grid' => [
1434 'data-settings' => [
1435 wp_json_encode( $ajax_settings ),
1436 ],
1437 ],
1438 ]
1439 );
1440 }
1441
1442 ?>
1443 <div <?php $this->print_render_attribute_string('upk-gratis-grid'); ?>>
1444 <div <?php $this->print_render_attribute_string('grid-wrap'); ?>>
1445
1446 <?php
1447 $i = 0;
1448 while ($wp_query->have_posts()) :
1449 $wp_query->the_post();
1450
1451 $thumbnail_size = $settings['primary_thumbnail_size'];
1452
1453 $i++;
1454 $active_item = '';
1455 if (_is_upk_pro_activated()) {
1456 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration.
1457 $active_item = apply_filters('gratis_grid_active_item', $this, $i);
1458 }
1459
1460 ?>
1461
1462 <?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $active_item); ?>
1463
1464 <?php endwhile; ?>
1465 </div>
1466 </div>
1467
1468 <?php $this->render_ajax_loadmore(); ?>
1469
1470 <?php
1471
1472 if ($settings['show_pagination']) { ?>
1473 <div class="ep-pagination">
1474 <?php ultimate_post_kit_post_pagination($wp_query, $this->get_id()); ?>
1475 </div>
1476 <?php
1477 }
1478 wp_reset_postdata();
1479 }
1480 }
1481