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

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