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

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

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