PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.3
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.3
4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 All 146 releases
ultimate-post-kit / modules / elite-grid / widgets / elite-grid.php

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

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