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

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

1,202 lines 39.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\HazelGrid\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 use UltimatePostKit\Utils;
13
14 use UltimatePostKit\Traits\Global_Widget_Controls;
15 use UltimatePostKit\Traits\Global_Widget_Functions;
16 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
17 use WP_Query;
18
19 if (!defined('ABSPATH')) {
20 exit;
21 } // Exit if accessed directly
22
23 class Hazel_Grid extends Group_Control_Query {
24
25 use Global_Widget_Controls;
26 use Global_Widget_Functions;
27
28 private $_query = null;
29
30 public function get_name() {
31 return 'upk-hazel-grid';
32 }
33
34 public function get_title() {
35 return BDTUPK . esc_html__('Hazel Grid', 'ultimate-post-kit');
36 }
37
38 public function get_icon() {
39 return 'upk-widget-icon upk-icon-hazel-grid';
40 }
41
42 public function get_categories() {
43 return ['ultimate-post-kit'];
44 }
45
46 public function get_keywords() {
47 return ['post', 'grid', 'blog', 'recent', 'news', 'hazel'];
48 }
49
50 public function get_style_depends() {
51 if ($this->upk_is_edit_mode()) {
52 return ['upk-all-styles'];
53 } else {
54 return ['upk-font', 'upk-hazel-grid'];
55 }
56 }
57
58 public function get_script_depends() {
59 if ($this->upk_is_edit_mode()) {
60 return ['upk-all-scripts'];
61 } else {
62 return ['upk-ajax-loadmore'];
63 }
64 }
65
66 public function get_custom_help_url() {
67 return 'https://youtu.be/Uy_rOg8lQJM';
68 }
69
70 public function get_query() {
71 return $this->_query;
72 }
73
74 public function has_widget_inner_wrapper(): bool {
75 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
76 }
77
78
79 protected function register_controls() {
80 $this->start_controls_section(
81 'section_content_layout',
82 [
83 'label' => esc_html__('Layout', 'ultimate-post-kit'),
84 ]
85 );
86
87 $this->add_control(
88 'grid_style',
89 [
90 'label' => esc_html__('Layout Style', 'ultimate-post-kit'),
91 'type' => Controls_Manager::SELECT,
92 'default' => '1',
93 'options' => [
94 '1' => esc_html__('Style 01', 'ultimate-post-kit'),
95 '2' => esc_html__('Style 02', 'ultimate-post-kit'),
96 '3' => esc_html__('Style 03', 'ultimate-post-kit'),
97 '4' => esc_html__('Style 04', 'ultimate-post-kit'),
98 '5' => esc_html__('Style 05', 'ultimate-post-kit'),
99 '6' => esc_html__('Style 06', 'ultimate-post-kit'),
100 '7' => esc_html__('Style 07', 'ultimate-post-kit'),
101 '8' => esc_html__('Style 08', 'ultimate-post-kit'),
102 '9' => esc_html__('Style 09', 'ultimate-post-kit'),
103 '10' => esc_html__('Style 10', 'ultimate-post-kit'),
104 ],
105 ]
106 );
107
108 $column_size = apply_filters('upk_column_size', '');
109
110 $this->add_responsive_control(
111 'columns',
112 [
113 'label' => __('Columns', 'ultimate-post-kit') . BDTUPK_PC,
114 'type' => Controls_Manager::SELECT,
115 'default' => '3',
116 'tablet_default' => '2',
117 'mobile_default' => '1',
118 'options' => [
119 '1' => '1',
120 '2' => '2',
121 '3' => '3',
122 '4' => '4',
123 '5' => '5',
124 '6' => '6',
125 ],
126 'selectors' => [
127 '{{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-1' => $column_size,
128 ],
129 'condition' => [
130 'grid_style' => ['1']
131 ],
132 'classes' => BDTUPK_IS_PC
133 ]
134 );
135
136 $this->add_responsive_control(
137 'row_gap',
138 [
139 'label' => esc_html__('Row Gap', 'ultimate-post-kit'),
140 'type' => Controls_Manager::SLIDER,
141 'default' => [
142 'size' => 20,
143 ],
144 'selectors' => [
145 '{{WRAPPER}} .upk-hazel-grid .upk-post-grid' => 'grid-row-gap: {{SIZE}}{{UNIT}};',
146 ],
147 ]
148 );
149
150 $this->add_responsive_control(
151 'column_gap',
152 [
153 'label' => esc_html__('Column Gap', 'ultimate-post-kit'),
154 'type' => Controls_Manager::SLIDER,
155 'default' => [
156 'size' => 20,
157 ],
158 'selectors' => [
159 '{{WRAPPER}} .upk-hazel-grid .upk-post-grid' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
160 ],
161 ]
162 );
163
164 $this->add_control(
165 'content_style',
166 [
167 'label' => esc_html__('Content Style', 'ultimate-post-kit'),
168 'type' => Controls_Manager::SELECT,
169 'default' => '1',
170 'options' => [
171 '1' => esc_html__('Style 01', 'ultimate-post-kit'),
172 '2' => esc_html__('Style 02', 'ultimate-post-kit'),
173 '3' => esc_html__('Style 03', 'ultimate-post-kit'),
174 ],
175 ]
176 );
177
178 $this->add_control(
179 'content_position',
180 [
181 'label' => esc_html__('Content Position', 'ultimate-post-kit'),
182 'type' => Controls_Manager::SELECT,
183 'default' => 'bottom-left',
184 'options' => [
185 'top-left' => esc_html__('Top Left', 'ultimate-post-kit'),
186 'top-right' => esc_html__('Top Right', 'ultimate-post-kit'),
187 'center-center' => esc_html__('Center', 'ultimate-post-kit'),
188 'bottom-left' => esc_html__('Bottom Left', 'ultimate-post-kit'),
189 'bottom-right' => esc_html__('Bottom Right', 'ultimate-post-kit'),
190 'bottom-center' => esc_html__('Bottom Center', 'ultimate-post-kit'),
191 ],
192 ]
193 );
194
195 $this->add_responsive_control(
196 'default_item_height',
197 [
198 'label' => esc_html__('Default Item Height', 'ultimate-post-kit'),
199 'type' => Controls_Manager::SLIDER,
200 'range' => [
201 'px' => [
202 'min' => 200,
203 'max' => 800,
204 ],
205 ],
206 'selectors' => [
207 '{{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-1 .upk-item, {{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-8 .upk-item:nth-child(n+1)' => 'height: {{SIZE}}px;',
208 ],
209 'condition' => [
210 'grid_style' => ['1', '8']
211 ]
212 ]
213 );
214
215 $this->add_responsive_control(
216 'primary_item_height',
217 [
218 'label' => esc_html__('Primary Item Height', 'ultimate-post-kit'),
219 'type' => Controls_Manager::SLIDER,
220 'range' => [
221 'px' => [
222 'min' => 200,
223 'max' => 800,
224 ],
225 ],
226 'selectors' => [
227 '{{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-5 .upk-item:nth-child(5n+1), {{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-5 .upk-item:nth-child(5n+2), {{WRAPPER}} .upk-hazel-grid .upk-post-grid.upk-style-5 .upk-item:nth-child(5n+4)' => 'height: {{SIZE}}px;',
228 ],
229 'condition' => [
230 'grid_style' => ['5']
231 ]
232 ]
233 );
234
235 $this->add_responsive_control(
236 'secondary_item_height',
237 [
238 'label' => esc_html__('Secondary Item Height', 'ultimate-post-kit'),
239 'type' => Controls_Manager::SLIDER,
240 'range' => [
241 'px' => [
242 'min' => 200,
243 'max' => 800,
244 ],
245 ],
246 'selectors' => [
247 '{{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+5), {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+6), {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+5), {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+1), {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+5), {{WRAPPER}} .upk-hazel-grid .upk-style-5 .upk-item:nth-child(5n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-5 .upk-item:nth-child(5n+5), {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+1), {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+5), {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+6), {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+7), {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+1), {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+2), {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+3), {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+4), {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+6)' => 'height: {{SIZE}}px;',
248 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+1)' => 'height: {{SIZE}}px;',
249 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+1)' => 'height: {{SIZE}}px;',
250 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+2)' => 'height: {{SIZE}}px;',
251 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+3)' => 'height: {{SIZE}}px;',
252 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+1)' => 'height: {{SIZE}}px;',
253 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+5)' => 'height: {{SIZE}}px;',
254 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+1)' => 'height: {{SIZE}}px;',
255 '(mobile){{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+5)' => 'height: {{SIZE}}px;',
256 ],
257 'condition' => [
258 'grid_style!' => ['1', '8']
259 ]
260 ]
261 );
262
263 $this->add_group_control(
264 Group_Control_Image_Size::get_type(),
265 [
266 'name' => 'primary_thumbnail',
267 'exclude' => ['custom'],
268 'default' => 'medium',
269 ]
270 );
271
272 $this->end_controls_section();
273
274 // Query Settings
275 $this->start_controls_section(
276 'section_post_query_builder',
277 [
278 'label' => esc_html__('Query', 'ultimate-post-kit'),
279 'tab' => Controls_Manager::TAB_CONTENT,
280 ]
281 );
282
283 $this->add_control(
284 'item_limit',
285 [
286 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
287 'type' => Controls_Manager::SLIDER,
288 'range' => [
289 'px' => [
290 'min' => 0,
291 'max' => 18,
292 'step' => 6
293 ],
294 ],
295 'default' => [
296 'size' => 6,
297 ],
298 'condition' => [
299 'grid_style' => ['1', '2', '8', '10']
300 ]
301 ]
302 );
303
304 $this->add_control(
305 'item_limit_3_4_5_6',
306 [
307 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
308 'type' => Controls_Manager::SLIDER,
309 'range' => [
310 'px' => [
311 'min' => 0,
312 'max' => 20,
313 'step' => 5
314 ],
315 ],
316 'default' => [
317 'size' => 5,
318 ],
319 'condition' => [
320 'grid_style' => ['3', '4', '5', '6']
321 ]
322 ]
323 );
324
325 $this->add_control(
326 'item_limit_7',
327 [
328 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
329 'type' => Controls_Manager::SLIDER,
330 'range' => [
331 'px' => [
332 'min' => 0,
333 'max' => 21,
334 'step' => 7
335 ],
336 ],
337 'default' => [
338 'size' => 7,
339 ],
340 'condition' => [
341 'grid_style' => ['7']
342 ]
343 ]
344 );
345
346 $this->add_control(
347 'item_limit_9',
348 [
349 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
350 'type' => Controls_Manager::SLIDER,
351 'range' => [
352 'px' => [
353 'min' => 0,
354 'max' => 20,
355 'step' => 4
356 ],
357 ],
358 'default' => [
359 'size' => 4,
360 ],
361 'condition' => [
362 'grid_style' => ['9']
363 ]
364 ]
365 );
366
367 $this->register_query_builder_controls();
368
369 $this->end_controls_section();
370
371 $this->start_controls_section(
372 'section_content_additional',
373 [
374 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
375 ]
376 );
377
378 //Global Title Controls
379 $this->register_title_controls();
380
381 $this->add_control(
382 'show_category',
383 [
384 'label' => esc_html__('Show Category', 'ultimate-post-kit'),
385 'type' => Controls_Manager::SWITCHER,
386 'default' => 'yes',
387 ]
388 );
389
390 $this->add_control(
391 'show_author',
392 [
393 'label' => esc_html__('Show Author', 'ultimate-post-kit'),
394 'type' => Controls_Manager::SWITCHER,
395 'default' => 'yes',
396 ]
397 );
398
399 //Global Date Controls
400 $this->register_date_controls();
401
402 //Global Reading Time Controls
403 $this->register_reading_time_controls();
404
405 $this->add_control(
406 'meta_separator',
407 [
408 'label' => esc_html__('Separator', 'ultimate-post-kit'),
409 'type' => Controls_Manager::TEXT,
410 'default' => '-',
411 'label_block' => false,
412 ]
413 );
414
415 $this->add_control(
416 'show_pagination',
417 [
418 'label' => esc_html__('Show Pagination', 'ultimate-post-kit'),
419 'type' => Controls_Manager::SWITCHER,
420 'separator' => 'before'
421 ]
422 );
423
424 //Global Ajax Controls
425 $this->register_ajax_loadmore_controls();
426
427 $this->add_control(
428 'global_link',
429 [
430 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
431 'type' => Controls_Manager::SWITCHER,
432 'prefix_class' => 'upk-global-link-',
433 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
434 ]
435 );
436
437 $this->end_controls_section();
438
439 $this->start_controls_section(
440 'upk_section_style',
441 [
442 'label' => esc_html__('Items', 'ultimate-post-kit'),
443 'tab' => Controls_Manager::TAB_STYLE,
444 ]
445 );
446
447 $this->add_control(
448 'overlay_blur_effect',
449 [
450 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
451 'type' => Controls_Manager::SWITCHER,
452 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
453 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1s look here %2s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'),
454 'default' => 'yes',
455 'condition' => [
456 'content_style' => '2',
457 ]
458 ]
459 );
460
461 $this->add_control(
462 'overlay_blur_level',
463 [
464 'label' => __('Blur Level', 'ultimate-post-kit'),
465 'type' => Controls_Manager::SLIDER,
466 'range' => [
467 'px' => [
468 'min' => 0,
469 'step' => 1,
470 'max' => 50,
471 ]
472 ],
473 'default' => [
474 'size' => 10
475 ],
476 'selectors' => [
477 '{{WRAPPER}} .upk-hazel-grid .upk-content-style-2 .upk-content' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);'
478 ],
479 'condition' => [
480 'overlay_blur_effect' => 'yes',
481 'content_style' => '2',
482 ]
483 ]
484 );
485
486 $this->add_control(
487 'overlay_background',
488 [
489 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
490 'type' => Controls_Manager::COLOR,
491 'selectors' => [
492 '{{WRAPPER}} .upk-hazel-grid .upk-content-style-1 .upk-item-box:before, {{WRAPPER}} .upk-hazel-grid .upk-content-style-2 .upk-content, {{WRAPPER}} .upk-hazel-grid .upk-content-style-3 .upk-item .upk-item-box:before' => 'background-color: {{VALUE}};'
493 ],
494 ]
495 );
496
497 $this->add_group_control(
498 Group_Control_Border::get_type(),
499 [
500 'name' => 'item_border',
501 'label' => __('Border', 'ultimate-post-kit'),
502 'placeholder' => '1px',
503 'default' => '1px',
504 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-item',
505 ]
506 );
507
508 $this->add_responsive_control(
509 'item_border_radius',
510 [
511 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
512 'type' => Controls_Manager::DIMENSIONS,
513 'size_units' => ['px', '%'],
514 'selectors' => [
515 '{{WRAPPER}} .upk-hazel-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
516 ],
517 ]
518 );
519
520 $this->add_responsive_control(
521 'content_padding',
522 [
523 'label' => __('Content Padding', 'ultimate-post-kit'),
524 'type' => Controls_Manager::DIMENSIONS,
525 'size_units' => ['px', 'em', '%'],
526 'selectors' => [
527 '{{WRAPPER}} .upk-hazel-grid .upk-content' => 'padding: {{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' => '',
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 'condition' => [
559 'content_style!' => '3'
560 ]
561 ]
562 );
563
564 $this->add_control(
565 'title_color',
566 [
567 'label' => esc_html__('Color', 'ultimate-post-kit'),
568 'type' => Controls_Manager::COLOR,
569 'selectors' => [
570 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'color: {{VALUE}};',
571 ],
572 ]
573 );
574
575 $this->add_control(
576 'title_hover_color',
577 [
578 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
579 'type' => Controls_Manager::COLOR,
580 'selectors' => [
581 '{{WRAPPER}} .upk-hazel-grid .upk-title a:hover' => 'color: {{VALUE}};',
582 ],
583 ]
584 );
585
586 $this->add_group_control(
587 Group_Control_Typography::get_type(),
588 [
589 'name' => 'title_typography',
590 'label' => esc_html__('Typography', 'ultimate-post-kit'),
591 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title',
592 ]
593 );
594
595 $this->add_group_control(
596 Group_Control_Typography::get_type(),
597 [
598 'name' => 'secondary_title_typography',
599 'label' => esc_html__('Secondary Typography', 'ultimate-post-kit'),
600 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+5) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-2 .upk-item:nth-child(6n+6) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-3 .upk-item:nth-child(5n+5) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+1) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-4 .upk-item:nth-child(5n+5) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-5 .upk-item:nth-child(5n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-5 .upk-item:nth-child(5n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-5 .upk-item:nth-child(5n+5) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+1) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-6 .upk-item:nth-child(5n+5) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+6) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-7 .upk-item:nth-child(7n+7) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-9 .upk-item:nth-child(4n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+1) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+2) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+3) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+4) .upk-title, {{WRAPPER}} .upk-hazel-grid .upk-style-10 .upk-item:nth-child(6n+6) .upk-title',
601 'condition' => [
602 'grid_style!' => ['1', '8']
603 ]
604 ]
605 );
606
607 $this->add_control(
608 'title_advanced_style',
609 [
610 'label' => esc_html__('Advanced Style', 'ultimate-post-kit'),
611 'type' => Controls_Manager::SWITCHER,
612 ]
613 );
614
615 $this->add_group_control(
616 Group_Control_Background::get_type(),
617 [
618 'name' => 'title_background',
619 'label' => __('Background', 'ultimate-post-kit'),
620 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
621 'condition' => [
622 'title_advanced_style' => 'yes'
623 ]
624 ]
625 );
626
627 $this->add_group_control(
628 Group_Control_Text_Shadow::get_type(),
629 [
630 'name' => 'title_text_shadow',
631 'label' => __('Text Shadow', 'ultimate-post-kit'),
632 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
633 'condition' => [
634 'title_advanced_style' => 'yes'
635 ]
636 ]
637 );
638
639 $this->add_group_control(
640 Group_Control_Border::get_type(),
641 [
642 'name' => 'title_border',
643 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
644 'condition' => [
645 'title_advanced_style' => 'yes'
646 ]
647 ]
648 );
649
650 $this->add_responsive_control(
651 'title_border_radius',
652 [
653 'label' => __('Border Radius', 'ultimate-post-kit'),
654 'type' => Controls_Manager::DIMENSIONS,
655 'size_units' => ['px', '%'],
656 'selectors' => [
657 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
658 ],
659 'condition' => [
660 'title_advanced_style' => 'yes'
661 ]
662 ]
663 );
664
665 $this->add_group_control(
666 Group_Control_Box_Shadow::get_type(),
667 [
668 'name' => 'title_box_shadow',
669 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
670 'condition' => [
671 'title_advanced_style' => 'yes'
672 ]
673 ]
674 );
675
676 $this->add_responsive_control(
677 'title_text_padding',
678 [
679 'label' => __('Padding', 'ultimate-post-kit'),
680 'type' => Controls_Manager::DIMENSIONS,
681 'size_units' => ['px', 'em', '%'],
682 'selectors' => [
683 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
684 ],
685 'condition' => [
686 'title_advanced_style' => 'yes'
687 ]
688 ]
689 );
690
691 $this->add_responsive_control(
692 'title_text_margin',
693 [
694 'label' => __('Margin', 'ultimate-post-kit'),
695 'type' => Controls_Manager::DIMENSIONS,
696 'size_units' => ['px', 'em', '%'],
697 'selectors' => [
698 '{{WRAPPER}} .upk-hazel-grid .upk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
699 ],
700 'condition' => [
701 'title_advanced_style' => 'yes'
702 ]
703 ]
704 );
705
706 $this->end_controls_section();
707
708 $this->start_controls_section(
709 'section_style_author_date',
710 [
711 'label' => esc_html__('Meta', 'ultimate-post-kit'),
712 'tab' => Controls_Manager::TAB_STYLE,
713 'conditions' => [
714 'relation' => 'or',
715 'terms' => [
716 [
717 'name' => 'show_author',
718 'value' => 'yes'
719 ],
720 [
721 'name' => 'show_date',
722 'value' => 'yes'
723 ]
724 ]
725 ],
726 ]
727 );
728
729 $this->add_group_control(
730 Group_Control_Background::get_type(),
731 [
732 'name' => 'author_date_background',
733 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-content-style-3 .upk-content .upk-meta',
734 'condition' => [
735 'content_style' => '3',
736 ],
737 ]
738 );
739
740 $this->add_control(
741 'author_divider',
742 [
743 'type' => Controls_Manager::DIVIDER,
744 'condition' => [
745 'content_style' => '3',
746 ],
747 ]
748 );
749
750 $this->add_control(
751 'author_color',
752 [
753 'label' => esc_html__('Text Color', 'ultimate-post-kit'),
754 'type' => Controls_Manager::COLOR,
755 'selectors' => [
756 '{{WRAPPER}} .upk-hazel-grid .upk-meta *' => 'color: {{VALUE}};',
757 ],
758 ]
759 );
760
761 $this->add_control(
762 'author_hover_color',
763 [
764 'label' => esc_html__('Hover Text Color', 'ultimate-post-kit'),
765 'type' => Controls_Manager::COLOR,
766 'selectors' => [
767 '{{WRAPPER}} .upk-hazel-grid .upk-meta .upk-blog-author a:hover' => 'color: {{VALUE}};',
768 ],
769 ]
770 );
771
772 $this->add_responsive_control(
773 'meta_space_between',
774 [
775 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
776 'type' => Controls_Manager::SLIDER,
777 'range' => [
778 'px' => [
779 'min' => 0,
780 'max' => 50,
781 ],
782 ],
783 'selectors' => [
784 '{{WRAPPER}} .upk-hazel-grid .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
785 ],
786 ]
787 );
788
789 $this->add_group_control(
790 Group_Control_Typography::get_type(),
791 [
792 'name' => 'author_typography',
793 'label' => esc_html__('Typography', 'ultimate-post-kit'),
794 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-meta',
795 ]
796 );
797
798 $this->end_controls_section();
799
800 $this->start_controls_section(
801 'section_style_category',
802 [
803 'label' => esc_html__('Category', 'ultimate-post-kit'),
804 'tab' => Controls_Manager::TAB_STYLE,
805 'condition' => [
806 'show_category' => 'yes',
807 ],
808 ]
809 );
810
811 $this->start_controls_tabs('tabs_category_style');
812
813 $this->start_controls_tab(
814 'tab_category_normal',
815 [
816 'label' => esc_html__('Normal', 'ultimate-post-kit'),
817 ]
818 );
819
820 $this->add_control(
821 'category_color',
822 [
823 'label' => esc_html__('Color', 'ultimate-post-kit'),
824 'type' => Controls_Manager::COLOR,
825 'selectors' => [
826 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'color: {{VALUE}};',
827 ],
828 ]
829 );
830
831 $this->add_group_control(
832 Group_Control_Background::get_type(),
833 [
834 'name' => 'category_background',
835 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
836 ]
837 );
838
839 $this->add_group_control(
840 Group_Control_Border::get_type(),
841 [
842 'name' => 'category_border',
843 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
844 ]
845 );
846
847 $this->add_responsive_control(
848 'category_border_radius',
849 [
850 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
851 'type' => Controls_Manager::DIMENSIONS,
852 'size_units' => ['px', '%'],
853 'selectors' => [
854 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
855 ],
856 ]
857 );
858
859 $this->add_responsive_control(
860 'category_padding',
861 [
862 'label' => esc_html__('Padding', 'ultimate-post-kit'),
863 'type' => Controls_Manager::DIMENSIONS,
864 'size_units' => ['px', 'em', '%'],
865 'selectors' => [
866 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
867 ],
868 ]
869 );
870
871 $this->add_responsive_control(
872 'category_spacing',
873 [
874 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
875 'type' => Controls_Manager::SLIDER,
876 'range' => [
877 'px' => [
878 'min' => 0,
879 'max' => 50,
880 'step' => 2,
881 ],
882 ],
883 'selectors' => [
884 '{{WRAPPER}} .upk-hazel-grid .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
885 ],
886 ]
887 );
888
889
890 $this->add_group_control(
891 Group_Control_Box_Shadow::get_type(),
892 [
893 'name' => 'category_shadow',
894 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
895 ]
896 );
897
898 $this->add_group_control(
899 Group_Control_Typography::get_type(),
900 [
901 'name' => 'category_typography',
902 'label' => esc_html__('Typography', 'ultimate-post-kit'),
903 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
904 ]
905 );
906
907 $this->end_controls_tab();
908
909 $this->start_controls_tab(
910 'tab_category_hover',
911 [
912 'label' => esc_html__('Hover', 'ultimate-post-kit'),
913 ]
914 );
915
916 $this->add_control(
917 'category_hover_color',
918 [
919 'label' => esc_html__('Color', 'ultimate-post-kit'),
920 'type' => Controls_Manager::COLOR,
921 'selectors' => [
922 '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover' => 'color: {{VALUE}};',
923 ],
924 ]
925 );
926
927 $this->add_group_control(
928 Group_Control_Background::get_type(),
929 [
930 'name' => 'category_hover_background',
931 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover',
932 ]
933 );
934
935 $this->add_control(
936 'category_hover_border_color',
937 [
938 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
939 'type' => Controls_Manager::COLOR,
940 'condition' => [
941 'category_border_border!' => '',
942 ],
943 'selectors' => [
944 '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover' => 'border-color: {{VALUE}};',
945 ],
946 ]
947 );
948
949 $this->end_controls_tab();
950
951 $this->end_controls_tabs();
952
953 $this->end_controls_section();
954
955 //Global Pagination Controls
956 $this->register_pagination_controls();
957
958 //Global Ajax Loadmore Controls
959 $this->register_ajax_loadmore_style_controls();
960 }
961
962 /**
963 * Main query render for this widget
964 * @param $posts_per_page number item query limit
965 */
966 public function query_posts($posts_per_page) {
967
968 $default = $this->getGroupControlQueryArgs();
969 $args = [];
970 if ($posts_per_page) {
971 $args['posts_per_page'] = $posts_per_page;
972 $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
973 }
974 $args = array_merge($default, $args);
975 $this->_query = new WP_Query($args);
976 }
977
978 public function render_author() {
979
980 if (!$this->get_settings('show_author')) {
981 return;
982 }
983
984 ?>
985
986 <div class="upk-blog-author">
987 <span class="by"><?php echo esc_html_x('by', 'Frontend', 'ultimate-post-kit') ?></span>
988 <span class="upk-post-grid-author">
989 <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>">
990 <?php echo esc_html( get_the_author() ) ?>
991 </a>
992 </span>
993 </div>
994
995 <?php
996 }
997
998 public function render_date() {
999 $settings = $this->get_settings_for_display();
1000
1001 if (!$this->get_settings('show_date')) {
1002 return;
1003 }
1004
1005 if ($settings['human_diff_time'] == 'yes') {
1006 echo esc_html( ultimate_post_kit_post_time_diff( ($settings['human_diff_time_short'] == 'yes') ? 'short' : '' ) );
1007 } else {
1008 echo get_the_date();
1009 }
1010 }
1011
1012 public function render_post_grid_item($post_id, $image_size) {
1013 $settings = $this->get_settings_for_display();
1014
1015 if ('yes' == $settings['global_link']) {
1016
1017 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
1018 }
1019 $this->add_render_attribute('grid-item', 'class', 'upk-item', true);
1020
1021 ?>
1022 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
1023 <div class="upk-item-box">
1024 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1025
1026 <div class="upk-content">
1027 <?php $this->render_category(); ?>
1028
1029 <div class="upk-title-wrap">
1030 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1031 </div>
1032
1033 <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
1034 <div class="upk-meta">
1035 <?php $this->render_author(); ?>
1036
1037 <?php if ($settings['show_date']) : ?>
1038 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1039 <div class="upk-date">
1040 <i class="upk-icon-calendar" aria-hidden="true"></i><?php $this->render_date(); ?>
1041 </div>
1042
1043 <?php if ($settings['show_time']) : ?>
1044 <div class="upk-post-time">
1045 <i class="upk-icon-clock" aria-hidden="true"></i>
1046 <?php echo esc_html( get_the_time() ); ?>
1047 </div>
1048 <?php endif; ?>
1049 </div>
1050 <?php endif; ?>
1051
1052 <?php if (_is_upk_pro_activated()) :
1053 if ('yes' === $settings['show_reading_time']) : ?>
1054 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1055 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1056 </div>
1057 <?php endif; ?>
1058 <?php endif; ?>
1059 </div>
1060 <?php endif; ?>
1061
1062
1063 </div>
1064 </div>
1065 </div>
1066 <?php
1067 }
1068
1069 protected function render() {
1070 $settings = $this->get_settings_for_display();
1071
1072 if ($settings['grid_style'] == '9') {
1073 $this->query_posts($settings['item_limit_9']['size']);
1074 } elseif ($settings['grid_style'] == '7') {
1075 $this->query_posts($settings['item_limit_7']['size']);
1076 } elseif ($settings['grid_style'] == '3' or $settings['grid_style'] == '4' or $settings['grid_style'] == '5' or $settings['grid_style'] == '6') {
1077 $this->query_posts($settings['item_limit_3_4_5_6']['size']);
1078 } else {
1079 $this->query_posts($settings['item_limit']['size']);
1080 }
1081
1082 $wp_query = $this->get_query();
1083
1084 if (!$wp_query->found_posts) {
1085 return;
1086 }
1087
1088 $this->add_render_attribute('grid-wrap', 'class', 'upk-post-grid upk-ajax-grid-wrap');
1089 $this->add_render_attribute('grid-wrap', 'class', 'upk-style-' . $settings['grid_style']);
1090 $this->add_render_attribute('grid-wrap', 'class', 'upk-text-position-' . $settings['content_position']);
1091 $this->add_render_attribute('grid-wrap', 'class', 'upk-content-style-' . $settings['content_style']);
1092
1093 $this->add_render_attribute(
1094 [
1095 'upk-hazel-grid' => [
1096 'class' => 'upk-hazel-grid upk-ajax-grid',
1097 'data-loadmore' => [
1098 wp_json_encode(
1099 array_filter(
1100 [
1101 'loadmore_enable' => $settings['ajax_loadmore_enable'],
1102 'loadmore_btn' => $settings['ajax_loadmore_btn'],
1103 'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'],
1104 ]
1105 )
1106 ),
1107 ],
1108 ],
1109 ]
1110 );
1111
1112 if ( $settings['ajax_loadmore_enable'] === 'yes' ) {
1113 $ajax_settings = [
1114 'posts_source' => isset( $settings['posts_source'] ) ? $settings['posts_source'] : 'post',
1115 'posts_per_page' => isset( $posts_load ) ? $posts_load : 6,
1116 'ajax_item_load' => isset( $settings['ajax_loadmore_items'] ) ? $settings['ajax_loadmore_items'] : 3,
1117 'posts_selected_ids' => isset( $settings['posts_selected_ids'] ) ? $settings['posts_selected_ids'] : '',
1118 'posts_include_by' => isset( $settings['posts_include_by'] ) ? $settings['posts_include_by'] : [],
1119 'posts_include_author_ids' => isset( $settings['posts_include_author_ids'] ) ? $settings['posts_include_author_ids'] : '',
1120 'posts_include_term_ids' => isset( $settings['posts_include_term_ids'] ) ? $settings['posts_include_term_ids'] : '',
1121 'posts_exclude_by' => isset( $settings['posts_exclude_by'] ) ? $settings['posts_exclude_by'] : [],
1122 'posts_exclude_ids' => isset( $settings['posts_exclude_ids'] ) ? $settings['posts_exclude_ids'] : '',
1123 'posts_exclude_author_ids' => isset( $settings['posts_exclude_author_ids'] ) ? $settings['posts_exclude_author_ids'] : '',
1124 'posts_exclude_term_ids' => isset( $settings['posts_exclude_term_ids'] ) ? $settings['posts_exclude_term_ids'] : '',
1125 'posts_offset' => isset( $settings['posts_offset'] ) ? $settings['posts_offset'] : 0,
1126 'posts_select_date' => isset( $settings['posts_select_date'] ) ? $settings['posts_select_date'] : '',
1127 'posts_date_before' => isset( $settings['posts_date_before'] ) ? $settings['posts_date_before'] : '',
1128 'posts_date_after' => isset( $settings['posts_date_after'] ) ? $settings['posts_date_after'] : '',
1129 'posts_orderby' => isset( $settings['posts_orderby'] ) ? $settings['posts_orderby'] : 'date',
1130 'posts_order' => isset( $settings['posts_order'] ) ? $settings['posts_order'] : 'DESC',
1131 'posts_ignore_sticky_posts' => isset( $settings['posts_ignore_sticky_posts'] ) ? $settings['posts_ignore_sticky_posts'] : 'no',
1132 'posts_only_with_featured_image' => isset( $settings['posts_only_with_featured_image'] ) ? $settings['posts_only_with_featured_image'] : 'no',
1133 // Grid Settings
1134 'show_title' => isset( $settings['show_title'] ) ? $settings['show_title'] : 'yes',
1135 'title_tags' => isset( $settings['title_tags'] ) ? $settings['title_tags'] : 'h3',
1136 'show_excerpt' => isset( $settings['show_excerpt'] ) ? $settings['show_excerpt'] : 'yes',
1137 'show_author' => isset( $settings['show_author'] ) ? $settings['show_author'] : 'yes',
1138 'show_date' => isset( $settings['show_date'] ) ? $settings['show_date'] : 'yes',
1139 'show_time' => isset( $settings['show_time'] ) ? $settings['show_time'] : 'no',
1140 'show_category' => isset( $settings['show_category'] ) ? $settings['show_category'] : 'yes',
1141 'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no',
1142 'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200,
1143 'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no',
1144 'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no',
1145 'upk_link_new_tab' => isset( $settings['upk_link_new_tab'] ) ? $settings['upk_link_new_tab'] : 'no',
1146 'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '|',
1147 'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no',
1148 'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no',
1149 'excerpt_length' => isset( $settings['excerpt_length'] ) ? $settings['excerpt_length'] : 20,
1150 'title_style' => isset( $settings['title_style'] ) ? $settings['title_style'] : 'underline',
1151 'global_link' => isset( $settings['global_link'] ) ? $settings['global_link'] : 'no',
1152 ];
1153
1154 $this->add_render_attribute(
1155 [
1156 'upk-hazel-grid' => [
1157 'data-settings' => [
1158 wp_json_encode( $ajax_settings ),
1159 ],
1160 ],
1161 ]
1162 );
1163 }
1164
1165 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
1166 $this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation');
1167 if (isset($settings['upk_in_animation_delay']['size'])) {
1168 $this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']);
1169 }
1170 }
1171
1172 ?>
1173 <div <?php $this->print_render_attribute_string('upk-hazel-grid'); ?>>
1174 <div <?php $this->print_render_attribute_string('grid-wrap'); ?>>
1175
1176 <?php while ($wp_query->have_posts()) :
1177 $wp_query->the_post();
1178
1179 $thumbnail_size = $settings['primary_thumbnail_size'];
1180
1181 ?>
1182
1183 <?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size); ?>
1184
1185 <?php endwhile; ?>
1186 </div>
1187 </div>
1188
1189 <?php $this->render_ajax_loadmore(); ?>
1190
1191 <?php
1192
1193 if ($settings['show_pagination']) { ?>
1194 <div class="ep-pagination">
1195 <?php ultimate_post_kit_post_pagination($wp_query, $this->get_id()); ?>
1196 </div>
1197 <?php
1198 }
1199 wp_reset_postdata();
1200 }
1201 }
1202