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

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

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