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 / 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.13, at modules/hazel-grid/widgets/hazel-grid.php

1,218 lines 39.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\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 'posts_source!' => 'current_query'
301 ]
302 ]
303 );
304
305 $this->add_control(
306 'item_limit_3_4_5_6',
307 [
308 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
309 'type' => Controls_Manager::SLIDER,
310 'range' => [
311 'px' => [
312 'min' => 0,
313 'max' => 20,
314 'step' => 5
315 ],
316 ],
317 'default' => [
318 'size' => 5,
319 ],
320 'condition' => [
321 'grid_style' => ['3', '4', '5', '6'],
322 'posts_source!' => 'current_query'
323 ]
324 ]
325 );
326
327 $this->add_control(
328 'item_limit_7',
329 [
330 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
331 'type' => Controls_Manager::SLIDER,
332 'range' => [
333 'px' => [
334 'min' => 0,
335 'max' => 21,
336 'step' => 7
337 ],
338 ],
339 'default' => [
340 'size' => 7,
341 ],
342 'condition' => [
343 'grid_style' => ['7'],
344 'posts_source!' => 'current_query'
345 ]
346 ]
347 );
348
349 $this->add_control(
350 'item_limit_9',
351 [
352 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
353 'type' => Controls_Manager::SLIDER,
354 'range' => [
355 'px' => [
356 'min' => 0,
357 'max' => 20,
358 'step' => 4
359 ],
360 ],
361 'default' => [
362 'size' => 4,
363 ],
364 'condition' => [
365 'grid_style' => ['9'],
366 'posts_source!' => 'current_query'
367 ]
368 ]
369 );
370
371 $this->register_query_builder_controls();
372
373 $this->end_controls_section();
374
375 $this->start_controls_section(
376 'section_content_additional',
377 [
378 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
379 ]
380 );
381
382 //Global Title Controls
383 $this->register_title_controls();
384
385 $this->add_control(
386 'show_category',
387 [
388 'label' => esc_html__('Show Category', 'ultimate-post-kit'),
389 'type' => Controls_Manager::SWITCHER,
390 'default' => 'yes',
391 ]
392 );
393
394 $this->add_control(
395 'show_author',
396 [
397 'label' => esc_html__('Show Author', 'ultimate-post-kit'),
398 'type' => Controls_Manager::SWITCHER,
399 'default' => 'yes',
400 ]
401 );
402
403 //Global Date Controls
404 $this->register_date_controls();
405
406 //Global Reading Time Controls
407 $this->register_reading_time_controls();
408
409 $this->add_control(
410 'meta_separator',
411 [
412 'label' => esc_html__('Separator', 'ultimate-post-kit'),
413 'type' => Controls_Manager::TEXT,
414 'default' => '-',
415 'label_block' => false,
416 ]
417 );
418
419 $this->add_control(
420 'show_pagination',
421 [
422 'label' => esc_html__('Show Pagination', 'ultimate-post-kit'),
423 'type' => Controls_Manager::SWITCHER,
424 'separator' => 'before'
425 ]
426 );
427
428 //Global Ajax Controls
429 $this->register_ajax_loadmore_controls();
430
431 $this->add_control(
432 'global_link',
433 [
434 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
435 'type' => Controls_Manager::SWITCHER,
436 'prefix_class' => 'upk-global-link-',
437 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
438 ]
439 );
440
441 $this->end_controls_section();
442
443 $this->start_controls_section(
444 'upk_section_style',
445 [
446 'label' => esc_html__('Items', 'ultimate-post-kit'),
447 'tab' => Controls_Manager::TAB_STYLE,
448 ]
449 );
450
451 $this->add_control(
452 'overlay_blur_effect',
453 [
454 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
455 'type' => Controls_Manager::SWITCHER,
456 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
457 '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>'),
458 'default' => 'yes',
459 'condition' => [
460 'content_style' => '2',
461 ]
462 ]
463 );
464
465 $this->add_control(
466 'overlay_blur_level',
467 [
468 'label' => __('Blur Level', 'ultimate-post-kit'),
469 'type' => Controls_Manager::SLIDER,
470 'range' => [
471 'px' => [
472 'min' => 0,
473 'step' => 1,
474 'max' => 50,
475 ]
476 ],
477 'default' => [
478 'size' => 10
479 ],
480 'selectors' => [
481 '{{WRAPPER}} .upk-hazel-grid .upk-content-style-2 .upk-content' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);'
482 ],
483 'condition' => [
484 'overlay_blur_effect' => 'yes',
485 'content_style' => '2',
486 ]
487 ]
488 );
489
490 $this->add_control(
491 'overlay_background',
492 [
493 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
494 'type' => Controls_Manager::COLOR,
495 'selectors' => [
496 '{{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}};'
497 ],
498 ]
499 );
500
501 $this->add_group_control(
502 Group_Control_Border::get_type(),
503 [
504 'name' => 'item_border',
505 'label' => __('Border', 'ultimate-post-kit'),
506 'placeholder' => '1px',
507 'default' => '1px',
508 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-item',
509 ]
510 );
511
512 $this->add_responsive_control(
513 'item_border_radius',
514 [
515 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
516 'type' => Controls_Manager::DIMENSIONS,
517 'size_units' => ['px', '%'],
518 'selectors' => [
519 '{{WRAPPER}} .upk-hazel-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
520 ],
521 ]
522 );
523
524 $this->add_responsive_control(
525 'content_padding',
526 [
527 'label' => __('Content Padding', 'ultimate-post-kit'),
528 'type' => Controls_Manager::DIMENSIONS,
529 'size_units' => ['px', 'em', '%'],
530 'selectors' => [
531 '{{WRAPPER}} .upk-hazel-grid .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
532 ],
533 ]
534 );
535
536 $this->end_controls_section();
537
538 $this->start_controls_section(
539 'section_style_title',
540 [
541 'label' => esc_html__('Title', 'ultimate-post-kit'),
542 'tab' => Controls_Manager::TAB_STYLE,
543 'condition' => [
544 'show_title' => 'yes',
545 ],
546 ]
547 );
548
549 $this->add_control(
550 'title_style',
551 [
552 'label' => esc_html__('Style', 'ultimate-post-kit'),
553 'type' => Controls_Manager::SELECT,
554 'default' => '',
555 'options' => [
556 '' => esc_html__('Default', 'ultimate-post-kit'),
557 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
558 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
559 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
560 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
561 ],
562 'condition' => [
563 'content_style!' => '3'
564 ]
565 ]
566 );
567
568 $this->add_control(
569 'title_color',
570 [
571 'label' => esc_html__('Color', 'ultimate-post-kit'),
572 'type' => Controls_Manager::COLOR,
573 'selectors' => [
574 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'color: {{VALUE}};',
575 ],
576 ]
577 );
578
579 $this->add_control(
580 'title_hover_color',
581 [
582 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
583 'type' => Controls_Manager::COLOR,
584 'selectors' => [
585 '{{WRAPPER}} .upk-hazel-grid .upk-title a:hover' => 'color: {{VALUE}};',
586 ],
587 ]
588 );
589
590 $this->add_group_control(
591 Group_Control_Typography::get_type(),
592 [
593 'name' => 'title_typography',
594 'label' => esc_html__('Typography', 'ultimate-post-kit'),
595 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title',
596 ]
597 );
598
599 $this->add_group_control(
600 Group_Control_Typography::get_type(),
601 [
602 'name' => 'secondary_title_typography',
603 'label' => esc_html__('Secondary Typography', 'ultimate-post-kit'),
604 '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',
605 'condition' => [
606 'grid_style!' => ['1', '8']
607 ]
608 ]
609 );
610
611 $this->add_control(
612 'title_advanced_style',
613 [
614 'label' => esc_html__('Advanced Style', 'ultimate-post-kit'),
615 'type' => Controls_Manager::SWITCHER,
616 ]
617 );
618
619 $this->add_group_control(
620 Group_Control_Background::get_type(),
621 [
622 'name' => 'title_background',
623 'label' => __('Background', 'ultimate-post-kit'),
624 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
625 'condition' => [
626 'title_advanced_style' => 'yes'
627 ]
628 ]
629 );
630
631 $this->add_group_control(
632 Group_Control_Text_Shadow::get_type(),
633 [
634 'name' => 'title_text_shadow',
635 'label' => __('Text Shadow', 'ultimate-post-kit'),
636 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
637 'condition' => [
638 'title_advanced_style' => 'yes'
639 ]
640 ]
641 );
642
643 $this->add_group_control(
644 Group_Control_Border::get_type(),
645 [
646 'name' => 'title_border',
647 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
648 'condition' => [
649 'title_advanced_style' => 'yes'
650 ]
651 ]
652 );
653
654 $this->add_responsive_control(
655 'title_border_radius',
656 [
657 'label' => __('Border Radius', 'ultimate-post-kit'),
658 'type' => Controls_Manager::DIMENSIONS,
659 'size_units' => ['px', '%'],
660 'selectors' => [
661 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
662 ],
663 'condition' => [
664 'title_advanced_style' => 'yes'
665 ]
666 ]
667 );
668
669 $this->add_group_control(
670 Group_Control_Box_Shadow::get_type(),
671 [
672 'name' => 'title_box_shadow',
673 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-title a',
674 'condition' => [
675 'title_advanced_style' => 'yes'
676 ]
677 ]
678 );
679
680 $this->add_responsive_control(
681 'title_text_padding',
682 [
683 'label' => __('Padding', 'ultimate-post-kit'),
684 'type' => Controls_Manager::DIMENSIONS,
685 'size_units' => ['px', 'em', '%'],
686 'selectors' => [
687 '{{WRAPPER}} .upk-hazel-grid .upk-title a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
688 ],
689 'condition' => [
690 'title_advanced_style' => 'yes'
691 ]
692 ]
693 );
694
695 $this->add_responsive_control(
696 'title_text_margin',
697 [
698 'label' => __('Margin', 'ultimate-post-kit'),
699 'type' => Controls_Manager::DIMENSIONS,
700 'size_units' => ['px', 'em', '%'],
701 'selectors' => [
702 '{{WRAPPER}} .upk-hazel-grid .upk-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
703 ],
704 'condition' => [
705 'title_advanced_style' => 'yes'
706 ]
707 ]
708 );
709
710 $this->end_controls_section();
711
712 $this->start_controls_section(
713 'section_style_author_date',
714 [
715 'label' => esc_html__('Meta', 'ultimate-post-kit'),
716 'tab' => Controls_Manager::TAB_STYLE,
717 'conditions' => [
718 'relation' => 'or',
719 'terms' => [
720 [
721 'name' => 'show_author',
722 'value' => 'yes'
723 ],
724 [
725 'name' => 'show_date',
726 'value' => 'yes'
727 ]
728 ]
729 ],
730 ]
731 );
732
733 $this->add_group_control(
734 Group_Control_Background::get_type(),
735 [
736 'name' => 'author_date_background',
737 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-content-style-3 .upk-content .upk-meta',
738 'condition' => [
739 'content_style' => '3',
740 ],
741 ]
742 );
743
744 $this->add_control(
745 'author_divider',
746 [
747 'type' => Controls_Manager::DIVIDER,
748 'condition' => [
749 'content_style' => '3',
750 ],
751 ]
752 );
753
754 $this->add_control(
755 'author_color',
756 [
757 'label' => esc_html__('Text Color', 'ultimate-post-kit'),
758 'type' => Controls_Manager::COLOR,
759 'selectors' => [
760 '{{WRAPPER}} .upk-hazel-grid .upk-meta *' => 'color: {{VALUE}};',
761 ],
762 ]
763 );
764
765 $this->add_control(
766 'author_hover_color',
767 [
768 'label' => esc_html__('Hover Text Color', 'ultimate-post-kit'),
769 'type' => Controls_Manager::COLOR,
770 'selectors' => [
771 '{{WRAPPER}} .upk-hazel-grid .upk-meta .upk-blog-author a:hover' => 'color: {{VALUE}};',
772 ],
773 ]
774 );
775
776 $this->add_responsive_control(
777 'meta_space_between',
778 [
779 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
780 'type' => Controls_Manager::SLIDER,
781 'range' => [
782 'px' => [
783 'min' => 0,
784 'max' => 50,
785 ],
786 ],
787 'selectors' => [
788 '{{WRAPPER}} .upk-hazel-grid .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
789 ],
790 ]
791 );
792
793 $this->add_group_control(
794 Group_Control_Typography::get_type(),
795 [
796 'name' => 'author_typography',
797 'label' => esc_html__('Typography', 'ultimate-post-kit'),
798 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-meta, {{WRAPPER}} .upk-hazel-grid .upk-meta *',
799 ]
800 );
801
802 $this->end_controls_section();
803
804 $this->start_controls_section(
805 'section_style_category',
806 [
807 'label' => esc_html__('Category', 'ultimate-post-kit'),
808 'tab' => Controls_Manager::TAB_STYLE,
809 'condition' => [
810 'show_category' => 'yes',
811 ],
812 ]
813 );
814
815 $this->start_controls_tabs('tabs_category_style');
816
817 $this->start_controls_tab(
818 'tab_category_normal',
819 [
820 'label' => esc_html__('Normal', 'ultimate-post-kit'),
821 ]
822 );
823
824 $this->add_control(
825 'category_color',
826 [
827 'label' => esc_html__('Color', 'ultimate-post-kit'),
828 'type' => Controls_Manager::COLOR,
829 'selectors' => [
830 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'color: {{VALUE}};',
831 ],
832 ]
833 );
834
835 $this->add_group_control(
836 Group_Control_Background::get_type(),
837 [
838 'name' => 'category_background',
839 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
840 ]
841 );
842
843 $this->add_group_control(
844 Group_Control_Border::get_type(),
845 [
846 'name' => 'category_border',
847 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
848 ]
849 );
850
851 $this->add_responsive_control(
852 'category_border_radius',
853 [
854 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
855 'type' => Controls_Manager::DIMENSIONS,
856 'size_units' => ['px', '%'],
857 'selectors' => [
858 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
859 ],
860 ]
861 );
862
863 $this->add_responsive_control(
864 'category_padding',
865 [
866 'label' => esc_html__('Padding', 'ultimate-post-kit'),
867 'type' => Controls_Manager::DIMENSIONS,
868 'size_units' => ['px', 'em', '%'],
869 'selectors' => [
870 '{{WRAPPER}} .upk-hazel-grid .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
871 ],
872 ]
873 );
874
875 $this->add_responsive_control(
876 'category_spacing',
877 [
878 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
879 'type' => Controls_Manager::SLIDER,
880 'range' => [
881 'px' => [
882 'min' => 0,
883 'max' => 50,
884 'step' => 2,
885 ],
886 ],
887 'selectors' => [
888 '{{WRAPPER}} .upk-hazel-grid .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
889 ],
890 ]
891 );
892
893
894 $this->add_group_control(
895 Group_Control_Box_Shadow::get_type(),
896 [
897 'name' => 'category_shadow',
898 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
899 ]
900 );
901
902 $this->add_group_control(
903 Group_Control_Typography::get_type(),
904 [
905 'name' => 'category_typography',
906 'label' => esc_html__('Typography', 'ultimate-post-kit'),
907 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a',
908 ]
909 );
910
911 $this->end_controls_tab();
912
913 $this->start_controls_tab(
914 'tab_category_hover',
915 [
916 'label' => esc_html__('Hover', 'ultimate-post-kit'),
917 ]
918 );
919
920 $this->add_control(
921 'category_hover_color',
922 [
923 'label' => esc_html__('Color', 'ultimate-post-kit'),
924 'type' => Controls_Manager::COLOR,
925 'selectors' => [
926 '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover' => 'color: {{VALUE}};',
927 ],
928 ]
929 );
930
931 $this->add_group_control(
932 Group_Control_Background::get_type(),
933 [
934 'name' => 'category_hover_background',
935 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover',
936 ]
937 );
938
939 $this->add_control(
940 'category_hover_border_color',
941 [
942 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
943 'type' => Controls_Manager::COLOR,
944 'condition' => [
945 'category_border_border!' => '',
946 ],
947 'selectors' => [
948 '{{WRAPPER}} .upk-hazel-grid .upk-category a:hover' => 'border-color: {{VALUE}};',
949 ],
950 ]
951 );
952
953 $this->end_controls_tab();
954
955 $this->end_controls_tabs();
956
957 $this->end_controls_section();
958
959 //Global Pagination Controls
960 $this->register_pagination_controls();
961
962 //Global Ajax Loadmore Controls
963 $this->register_ajax_loadmore_style_controls();
964 }
965
966 /**
967 * Get post query builder arguments
968 */
969 public function query_posts( $posts_per_page ) {
970 $settings = $this->get_settings();
971 $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
972 $args = $this->getGroupControlQueryArgs();
973 $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
974
975 if ( $is_current_query ) {
976 unset( $args['offset'] );
977 unset( $args['no_found_rows'] );
978 $posts_per_page = 0;
979 }
980
981 if ( $posts_per_page > 0 ) {
982 $args['posts_per_page'] = $posts_per_page;
983 } else {
984 $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
985 }
986
987 if ( $settings['show_pagination'] ) {
988 $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
989 }
990
991 $this->_query = new \WP_Query( $args );
992 }
993
994 public function render_author() {
995
996 if (!$this->get_settings('show_author')) {
997 return;
998 }
999
1000 ?>
1001
1002 <div class="upk-blog-author">
1003 <span class="by"><?php echo esc_html_x('By', 'Frontend', 'ultimate-post-kit') ?></span>
1004 <span class="upk-post-grid-author">
1005 <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>">
1006 <?php echo esc_html( get_the_author() ) ?>
1007 </a>
1008 </span>
1009 </div>
1010
1011 <?php
1012 }
1013
1014 public function render_date() {
1015 $settings = $this->get_settings_for_display();
1016
1017 if (!$this->get_settings('show_date')) {
1018 return;
1019 }
1020
1021 if ($settings['human_diff_time'] == 'yes') {
1022 echo esc_html( ultimate_post_kit_post_time_diff( ($settings['human_diff_time_short'] == 'yes') ? 'short' : '' ) );
1023 } else {
1024 echo get_the_date();
1025 }
1026 }
1027
1028 public function render_post_grid_item($post_id, $image_size) {
1029 $settings = $this->get_settings_for_display();
1030
1031 if ('yes' == $settings['global_link']) {
1032
1033 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
1034 }
1035 $this->add_render_attribute('grid-item', 'class', 'upk-item', true);
1036
1037 ?>
1038 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
1039 <div class="upk-item-box">
1040 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1041
1042 <div class="upk-content">
1043 <?php $this->render_category(); ?>
1044
1045 <div class="upk-title-wrap">
1046 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1047 </div>
1048
1049 <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
1050 <div class="upk-meta">
1051 <?php $this->render_author(); ?>
1052
1053 <?php if ($settings['show_date']) : ?>
1054 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1055 <div class="upk-date">
1056 <i class="upk-icon-calendar" aria-hidden="true"></i><?php $this->render_date(); ?>
1057 </div>
1058
1059 <?php if ($settings['show_time']) : ?>
1060 <div class="upk-post-time">
1061 <i class="upk-icon-clock" aria-hidden="true"></i>
1062 <?php echo esc_html( get_the_time() ); ?>
1063 </div>
1064 <?php endif; ?>
1065 </div>
1066 <?php endif; ?>
1067
1068 <?php if (_is_upk_pro_activated()) :
1069 if ('yes' === $settings['show_reading_time']) : ?>
1070 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1071 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1072 </div>
1073 <?php endif; ?>
1074 <?php endif; ?>
1075 </div>
1076 <?php endif; ?>
1077
1078
1079 </div>
1080 </div>
1081 </div>
1082 <?php
1083 }
1084
1085 protected function render() {
1086 $settings = $this->get_settings_for_display();
1087
1088 if ($settings['grid_style'] == '9') {
1089 $this->query_posts($settings['item_limit_9']['size']);
1090 } elseif ($settings['grid_style'] == '7') {
1091 $this->query_posts($settings['item_limit_7']['size']);
1092 } elseif ($settings['grid_style'] == '3' or $settings['grid_style'] == '4' or $settings['grid_style'] == '5' or $settings['grid_style'] == '6') {
1093 $this->query_posts($settings['item_limit_3_4_5_6']['size']);
1094 } else {
1095 $this->query_posts($settings['item_limit']['size']);
1096 }
1097
1098 $wp_query = $this->get_query();
1099
1100 if (!$wp_query->found_posts) {
1101 return;
1102 }
1103
1104 $this->add_render_attribute('grid-wrap', 'class', 'upk-post-grid upk-ajax-grid-wrap');
1105 $this->add_render_attribute('grid-wrap', 'class', 'upk-style-' . $settings['grid_style']);
1106 $this->add_render_attribute('grid-wrap', 'class', 'upk-text-position-' . $settings['content_position']);
1107 $this->add_render_attribute('grid-wrap', 'class', 'upk-content-style-' . $settings['content_style']);
1108
1109 $this->add_render_attribute(
1110 [
1111 'upk-hazel-grid' => [
1112 'class' => 'upk-hazel-grid upk-ajax-grid',
1113 'data-loadmore' => [
1114 wp_json_encode(
1115 array_filter(
1116 [
1117 'loadmore_enable' => $settings['ajax_loadmore_enable'],
1118 'loadmore_btn' => $settings['ajax_loadmore_btn'],
1119 'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'],
1120 ]
1121 )
1122 ),
1123 ],
1124 ],
1125 ]
1126 );
1127
1128 if ( $settings['ajax_loadmore_enable'] === 'yes' ) {
1129 $ajax_settings = [
1130 'posts_source' => isset( $settings['posts_source'] ) ? $settings['posts_source'] : 'post',
1131 'posts_per_page' => isset( $posts_load ) ? $posts_load : 6,
1132 'ajax_item_load' => isset( $settings['ajax_loadmore_items'] ) ? $settings['ajax_loadmore_items'] : 3,
1133 'posts_selected_ids' => isset( $settings['posts_selected_ids'] ) ? $settings['posts_selected_ids'] : '',
1134 'posts_include_by' => isset( $settings['posts_include_by'] ) ? $settings['posts_include_by'] : [],
1135 'posts_include_author_ids' => isset( $settings['posts_include_author_ids'] ) ? $settings['posts_include_author_ids'] : '',
1136 'posts_include_term_ids' => isset( $settings['posts_include_term_ids'] ) ? $settings['posts_include_term_ids'] : '',
1137 'posts_exclude_by' => isset( $settings['posts_exclude_by'] ) ? $settings['posts_exclude_by'] : [],
1138 'posts_exclude_ids' => isset( $settings['posts_exclude_ids'] ) ? $settings['posts_exclude_ids'] : '',
1139 'posts_exclude_author_ids' => isset( $settings['posts_exclude_author_ids'] ) ? $settings['posts_exclude_author_ids'] : '',
1140 'posts_exclude_term_ids' => isset( $settings['posts_exclude_term_ids'] ) ? $settings['posts_exclude_term_ids'] : '',
1141 'posts_offset' => isset( $settings['posts_offset'] ) ? $settings['posts_offset'] : 0,
1142 'posts_select_date' => isset( $settings['posts_select_date'] ) ? $settings['posts_select_date'] : '',
1143 'posts_date_before' => isset( $settings['posts_date_before'] ) ? $settings['posts_date_before'] : '',
1144 'posts_date_after' => isset( $settings['posts_date_after'] ) ? $settings['posts_date_after'] : '',
1145 'posts_orderby' => isset( $settings['posts_orderby'] ) ? $settings['posts_orderby'] : 'date',
1146 'posts_order' => isset( $settings['posts_order'] ) ? $settings['posts_order'] : 'DESC',
1147 'posts_ignore_sticky_posts' => isset( $settings['posts_ignore_sticky_posts'] ) ? $settings['posts_ignore_sticky_posts'] : 'no',
1148 'posts_only_with_featured_image' => isset( $settings['posts_only_with_featured_image'] ) ? $settings['posts_only_with_featured_image'] : 'no',
1149 // Grid Settings
1150 'show_title' => isset( $settings['show_title'] ) ? $settings['show_title'] : 'yes',
1151 'title_tags' => isset( $settings['title_tags'] ) ? $settings['title_tags'] : 'h3',
1152 'show_excerpt' => isset( $settings['show_excerpt'] ) ? $settings['show_excerpt'] : 'yes',
1153 'show_author' => isset( $settings['show_author'] ) ? $settings['show_author'] : 'yes',
1154 'show_date' => isset( $settings['show_date'] ) ? $settings['show_date'] : 'yes',
1155 'show_time' => isset( $settings['show_time'] ) ? $settings['show_time'] : 'no',
1156 'show_category' => isset( $settings['show_category'] ) ? $settings['show_category'] : 'yes',
1157 'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no',
1158 'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200,
1159 'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no',
1160 'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no',
1161 'upk_link_new_tab' => isset( $settings['upk_link_new_tab'] ) ? $settings['upk_link_new_tab'] : 'no',
1162 'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '|',
1163 'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no',
1164 'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no',
1165 'excerpt_length' => isset( $settings['excerpt_length'] ) ? $settings['excerpt_length'] : 20,
1166 'title_style' => isset( $settings['title_style'] ) ? $settings['title_style'] : 'underline',
1167 'global_link' => isset( $settings['global_link'] ) ? $settings['global_link'] : 'no',
1168 ];
1169
1170 $this->add_render_attribute(
1171 [
1172 'upk-hazel-grid' => [
1173 'data-settings' => [
1174 wp_json_encode( $ajax_settings ),
1175 ],
1176 ],
1177 ]
1178 );
1179 }
1180
1181 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
1182 $this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation');
1183 if (isset($settings['upk_in_animation_delay']['size'])) {
1184 $this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']);
1185 }
1186 }
1187
1188 ?>
1189 <div <?php $this->print_render_attribute_string('upk-hazel-grid'); ?>>
1190 <div <?php $this->print_render_attribute_string('grid-wrap'); ?>>
1191
1192 <?php while ($wp_query->have_posts()) :
1193 $wp_query->the_post();
1194
1195 $thumbnail_size = $settings['primary_thumbnail_size'];
1196
1197 ?>
1198
1199 <?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size); ?>
1200
1201 <?php endwhile; ?>
1202 </div>
1203 </div>
1204
1205 <?php $this->render_ajax_loadmore(); ?>
1206
1207 <?php
1208
1209 if ($settings['show_pagination']) { ?>
1210 <div class="ep-pagination">
1211 <?php ultimate_post_kit_post_pagination($wp_query, $this->get_id()); ?>
1212 </div>
1213 <?php
1214 }
1215 wp_reset_postdata();
1216 }
1217 }
1218