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.6 4.5.5 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 All 148 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.0.9, at modules/elite-grid/widgets/elite-grid.php

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