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

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

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