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

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

1,855 lines 53.6 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\AlterGrid\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 Elementor\Icons_Manager;
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 Alter_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-alter-grid';
32 }
33
34 public function get_title() {
35 return BDTUPK . esc_html__('Alter Grid', 'ultimate-post-kit');
36 }
37
38 public function get_icon() {
39 return 'upk-widget-icon upk-icon-alter-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', 'alter'];
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-alter-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/lJdoW-aPAe8';
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 ],
98 ]
99 );
100
101 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration.
102 $column_size = apply_filters('upk_column_size', '');
103
104 $this->add_responsive_control(
105 'columns',
106 [
107 'label' => esc_html__('Columns', 'ultimate-post-kit') . BDTUPK_PC,
108 'type' => Controls_Manager::SELECT,
109 'default' => '3',
110 'tablet_default' => '2',
111 'mobile_default' => '1',
112 'options' => [
113 '1' => esc_html__('1', 'ultimate-post-kit'),
114 '2' => esc_html__('2', 'ultimate-post-kit'),
115 '3' => esc_html__('3', 'ultimate-post-kit'),
116 '4' => esc_html__('4', 'ultimate-post-kit'),
117 '5' => esc_html__('5', 'ultimate-post-kit'),
118 '6' => esc_html__('6', 'ultimate-post-kit'),
119 ],
120 'selectors' => [
121 '{{WRAPPER}} .upk-alter-grid .upk-style-1' => $column_size,
122 ],
123 'condition' => [
124 'grid_style' => ['1']
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-alter-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-alter-grid .upk-post-grid' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
148 ]
149 ]
150 );
151
152 $this->add_responsive_control(
153 'image_height',
154 [
155 'label' => esc_html__('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-alter-grid .upk-img-wrap .upk-main-img .upk-img' => 'height: {{SIZE}}px;',
165 ],
166 'condition' => [
167 'grid_style' => ['1']
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-alter-grid .upk-style-2 .upk-item:nth-child(4n+2), {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+3), {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+4), {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+2) .upk-img-wrap .upk-main-img .upk-img, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+3) .upk-img-wrap .upk-main-img .upk-img, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+4) .upk-img-wrap .upk-main-img .upk-img, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+5) .upk-img-wrap .upk-main-img .upk-img' => 'height: {{SIZE}}px;',
185 ],
186 'condition' => [
187 'grid_style' => ['2', '3']
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-alter-grid .upk-style-2 .upk-item:nth-child(4n+2) .upk-img-wrap .upk-main-img, {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+3) .upk-img-wrap .upk-main-img, {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+4) .upk-img-wrap .upk-main-img' => 'width: {{SIZE}}px;',
205 ],
206 'condition' => [
207 'grid_style' => ['2']
208 ]
209 ]
210 );
211
212 $this->add_group_control(
213 Group_Control_Image_Size::get_type(),
214 [
215 'name' => 'primary_thumbnail',
216 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
217 'exclude' => ['custom'],
218 'default' => 'medium',
219 ]
220 );
221
222 $this->add_control(
223 'content_on_image',
224 [
225 'label' => esc_html__('Content on Image', 'ultimate-post-kit') . BDTUPK_PC,
226 'type' => Controls_Manager::SWITCHER,
227 'prefix_class' => 'upk-content-on-image-',
228 'separator' => 'before',
229 'classes' => BDTUPK_IS_PC,
230 'render_type' => 'template',
231 'condition' => [
232 'grid_style' => ['1']
233 ]
234 ]
235 );
236
237 $this->add_control(
238 'alter_grid_notice',
239 [
240 'type' => Controls_Manager::RAW_HTML,
241 'raw' => esc_html__( 'If you enable this feature, Read more type "on image" will not work.', 'ultimate-post-kit' ),
242 'content_classes' => 'elementor-panel-alert elementor-panel-alert-warning',
243 'condition' => [
244 'content_on_image' => 'yes',
245 ],
246 ]
247 );
248
249 $this->add_responsive_control(
250 'item_height',
251 [
252 'label' => esc_html__('Item Height', 'ultimate-post-kit'),
253 'type' => Controls_Manager::SLIDER,
254 'range' => [
255 'px' => [
256 'min' => 100,
257 'max' => 800,
258 ],
259 ],
260 'selectors' => [
261 '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-item' => 'height: {{SIZE}}px;',
262 ],
263 'condition' => [
264 'content_on_image' => 'yes'
265 ]
266 ]
267 );
268
269 $this->add_responsive_control(
270 'content_height',
271 [
272 'label' => esc_html__('Content Height', 'ultimate-post-kit'),
273 'type' => Controls_Manager::SLIDER,
274 'range' => [
275 'px' => [
276 'min' => 50,
277 'max' => 200,
278 ],
279 ],
280 'selectors' => [
281 '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-item .upk-content' => 'height: {{SIZE}}px;',
282 ],
283 'condition' => [
284 'content_on_image' => 'yes'
285 ]
286 ]
287 );
288
289 $this->end_controls_section();
290
291 // Query Settings
292 $this->start_controls_section(
293 'section_post_query_builder',
294 [
295 'label' => esc_html__('Query', 'ultimate-post-kit'),
296 'tab' => Controls_Manager::TAB_CONTENT,
297 ]
298 );
299
300 $this->add_control(
301 'item_limit',
302 [
303 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
304 'type' => Controls_Manager::SLIDER,
305 'range' => [
306 'px' => [
307 'min' => 0,
308 'max' => 21,
309 'step' => 3
310 ],
311 ],
312 'default' => [
313 'size' => 6,
314 ],
315 'condition' => [
316 'grid_style' => ['1'],
317 'posts_source!' => 'current_query'
318 ]
319 ]
320 );
321
322 $this->add_control(
323 'item_limit_2',
324 [
325 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
326 'type' => Controls_Manager::SLIDER,
327 'range' => [
328 'px' => [
329 'min' => 0,
330 'max' => 20,
331 'step' => 4
332 ],
333 ],
334 'default' => [
335 'size' => 4,
336 ],
337 'condition' => [
338 'grid_style' => ['2'],
339 'posts_source!' => 'current_query'
340 ]
341 ]
342 );
343
344 $this->add_control(
345 'item_limit_3',
346 [
347 'label' => esc_html__('Item Limit', 'ultimate-post-kit'),
348 'type' => Controls_Manager::SLIDER,
349 'range' => [
350 'px' => [
351 'min' => 0,
352 'max' => 20,
353 'step' => 5
354 ],
355 ],
356 'default' => [
357 'size' => 5,
358 ],
359 'condition' => [
360 'grid_style' => ['3'],
361 'posts_source!' => 'current_query'
362 ]
363 ]
364 );
365
366 $this->register_query_builder_controls();
367
368 $this->end_controls_section();
369
370 $this->start_controls_section(
371 'section_content_additional',
372 [
373 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
374 ]
375 );
376
377 //Global Title & Text Controls
378 $this->register_title_controls();
379 $this->register_text_controls();
380
381 $this->add_control(
382 'show_author',
383 [
384 'label' => esc_html__('Show Author', 'ultimate-post-kit'),
385 'type' => Controls_Manager::SWITCHER,
386 'default' => 'yes',
387 'separator' => 'before'
388 ]
389 );
390
391 $this->add_control(
392 'meta_separator',
393 [
394 'label' => esc_html__('Separator', 'ultimate-post-kit'),
395 'type' => Controls_Manager::TEXT,
396 'default' => '|',
397 'label_block' => false,
398 ]
399 );
400
401 //Global Date Controls
402 $this->register_date_controls();
403
404 // if (_is_upk_pro_activated()) :
405 // endif;
406 //Global Reading Time Controls
407 $this->register_reading_time_controls();
408
409 $this->add_control(
410 'show_category',
411 [
412 'label' => esc_html__('Show Category', 'ultimate-post-kit'),
413 'type' => Controls_Manager::SWITCHER,
414 'default' => 'yes',
415 'separator' => 'before'
416 ]
417 );
418
419 $this->add_control(
420 'primary_meta_end_position',
421 [
422 'label' => esc_html__('Primary Meta End Position', 'ultimate-post-kit'),
423 'type' => Controls_Manager::SWITCHER,
424 'default' => 'yes',
425 'prefix_class' => 'upk-primary-meta-end-position--',
426 ]
427 );
428
429 $this->add_control(
430 'secondary_meta_end_position',
431 [
432 'label' => esc_html__('Secondary Meta End Position', 'ultimate-post-kit'),
433 'type' => Controls_Manager::SWITCHER,
434 'prefix_class' => 'upk-secondary-meta-end-position--',
435 'condition' => [
436 'grid_style!' => '1'
437 ]
438 ]
439 );
440
441 $this->add_control(
442 'readmore_type',
443 [
444 'label' => esc_html__('Read More Type', 'ultimate-post-kit') . BDTUPK_PC,
445 'type' => Controls_Manager::SELECT,
446 'default' => 'none',
447 'options' => [
448 'none' => esc_html__('None', 'ultimate-post-kit'),
449 'classic' => esc_html__('Classic', 'ultimate-post-kit'),
450 'on_image' => esc_html__('On Image', 'ultimate-post-kit'),
451 ],
452 'separator' => 'before',
453 'classes' => BDTUPK_IS_PC,
454 ]
455 );
456
457 $this->add_control(
458 'show_post_format',
459 [
460 'label' => esc_html__('Post Format', 'ultimate-post-kit'),
461 'type' => Controls_Manager::SWITCHER,
462 'separator' => 'before'
463 ]
464 );
465
466 $this->add_control(
467 'show_pagination',
468 [
469 'label' => esc_html__('Pagination', 'ultimate-post-kit'),
470 'type' => Controls_Manager::SWITCHER,
471 'separator' => 'before'
472 ]
473 );
474
475 //Global Ajax Controls
476 $this->register_ajax_loadmore_controls();
477
478 $this->add_control(
479 'global_link',
480 [
481 'label' => esc_html__('Item Wrapper Link', 'ultimate-post-kit'),
482 'type' => Controls_Manager::SWITCHER,
483 'prefix_class' => 'upk-global-link-',
484 'description' => esc_html__('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
485 ]
486 );
487
488 $this->end_controls_section();
489
490 $this->start_controls_section(
491 'section_content_readmore',
492 [
493 'label' => esc_html__('Read More', 'ultimate-post-kit'),
494 'condition' => [
495 'readmore_type' => 'classic',
496 ],
497 ]
498 );
499
500 $this->add_control(
501 'readmore_text',
502 [
503 'label' => esc_html__('Read More Text', 'ultimate-post-kit'),
504 'type' => Controls_Manager::TEXT,
505 'dynamic' => [ 'active' => true ],
506 'default' => esc_html__('Read More', 'ultimate-post-kit'),
507 'placeholder' => esc_html__('Read More', 'ultimate-post-kit'),
508 ]
509 );
510
511 $this->add_control(
512 'readmore_icon',
513 [
514 'label' => esc_html__('Icon', 'ultimate-post-kit'),
515 'type' => Controls_Manager::ICONS,
516 'label_block' => false,
517 'skin' => 'inline'
518 ]
519 );
520
521 $this->add_control(
522 'readmore_icon_align',
523 [
524 'label' => esc_html__('Icon Position', 'ultimate-post-kit'),
525 'type' => Controls_Manager::CHOOSE,
526 'default' => 'right',
527 'toggle' => false,
528 'options' => [
529 'left' => [
530 'title' => esc_html__('Left', 'ultimate-post-kit'),
531 'icon' => 'eicon-h-align-left',
532 ],
533 'right' => [
534 'title' => esc_html__('Right', 'ultimate-post-kit'),
535 'icon' => 'eicon-h-align-right',
536 ],
537 ],
538 'condition' => [
539 'readmore_icon[value]!' => '',
540 ],
541 ]
542 );
543
544 $this->add_responsive_control(
545 'readmore_icon_indent',
546 [
547 'label' => esc_html__('Icon Spacing', 'ultimate-post-kit'),
548 'type' => Controls_Manager::SLIDER,
549 'default' => [
550 'size' => 8,
551 ],
552 'range' => [
553 'px' => [
554 'max' => 50,
555 ],
556 ],
557 'condition' => [
558 'readmore_icon[value]!' => '',
559 ],
560 'selectors' => [
561 '{{WRAPPER}} .upk-alter-grid .upk-button-icon-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};',
562 '{{WRAPPER}} .upk-alter-grid .upk-button-icon-align-left' => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};',
563 ],
564 ]
565 );
566
567 $this->end_controls_section();
568
569 //Style
570 $this->start_controls_section(
571 'upk_section_style',
572 [
573 'label' => esc_html__('Items', 'ultimate-post-kit'),
574 'tab' => Controls_Manager::TAB_STYLE,
575 ]
576 );
577
578 $this->add_control(
579 'overlay_blur_effect',
580 [
581 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
582 'type' => Controls_Manager::SWITCHER,
583 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
584 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'),
585 'default' => 'yes',
586 'condition' => [
587 'content_on_image' => 'yes'
588 ]
589 ]
590 );
591
592 $this->add_control(
593 'overlay_blur_level',
594 [
595 'label' => esc_html__('Blur Level', 'ultimate-post-kit'),
596 'type' => Controls_Manager::SLIDER,
597 'range' => [
598 'px' => [
599 'min' => 0,
600 'step' => 1,
601 'max' => 50,
602 ]
603 ],
604 'default' => [
605 'size' => 10
606 ],
607 'selectors' => [
608 '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-content' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);'
609 ],
610 'condition' => [
611 'overlay_blur_effect' => 'yes',
612 'content_on_image' => 'yes'
613 ]
614 ]
615 );
616
617 $this->add_responsive_control(
618 'content_padding',
619 [
620 'label' => esc_html__('Content Padding', 'ultimate-post-kit'),
621 'type' => Controls_Manager::DIMENSIONS,
622 'size_units' => ['px', 'em', '%'],
623 'selectors' => [
624 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
625 ],
626 ]
627 );
628
629 $this->start_controls_tabs('tabs_item_style');
630
631 $this->start_controls_tab(
632 'tab_item_normal',
633 [
634 'label' => esc_html__('Normal', 'ultimate-post-kit'),
635 ]
636 );
637
638 $this->add_group_control(
639 Group_Control_Background::get_type(),
640 [
641 'name' => 'itam_background',
642 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item',
643 'condition' => [
644 'content_on_image!' => 'yes'
645 ]
646 ]
647 );
648
649 $this->add_group_control(
650 Group_Control_Background::get_type(),
651 [
652 'name' => 'itam_content_background',
653 'selector' => '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-content',
654 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
655 'exclude' => ['image'],
656 'condition' => [
657 'content_on_image' => 'yes'
658 ]
659 ]
660 );
661
662 $this->add_group_control(
663 Group_Control_Border::get_type(),
664 [
665 'name' => 'item_border',
666 'label' => esc_html__('Border', 'ultimate-post-kit'),
667 'placeholder' => '1px',
668 'default' => '1px',
669 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item',
670 'separator' => 'before'
671 ]
672 );
673
674 $this->add_responsive_control(
675 'item_border_radius',
676 [
677 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
678 'type' => Controls_Manager::DIMENSIONS,
679 'size_units' => ['px', '%'],
680 'selectors' => [
681 '{{WRAPPER}} .upk-alter-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
682 ],
683 ]
684 );
685
686 $this->add_group_control(
687 Group_Control_Box_Shadow::get_type(),
688 [
689 'name' => 'item_box_shadow',
690 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item',
691 ]
692 );
693
694 $this->end_controls_tab();
695
696 $this->start_controls_tab(
697 'tab_item_hover',
698 [
699 'label' => esc_html__('Hover', 'ultimate-post-kit'),
700 ]
701 );
702
703 $this->add_group_control(
704 Group_Control_Background::get_type(),
705 [
706 'name' => 'itam_background_color_hover',
707 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item:hover',
708 'condition' => [
709 'content_on_image!' => 'yes'
710 ]
711 ]
712 );
713
714 $this->add_group_control(
715 Group_Control_Background::get_type(),
716 [
717 'name' => 'itam_content_hover_background',
718 'selector' => '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-item:hover .upk-content',
719 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
720 'exclude' => ['image'],
721 'condition' => [
722 'content_on_image' => 'yes'
723 ]
724 ]
725 );
726
727 $this->add_control(
728 'item_border_color_hover',
729 [
730 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
731 'type' => Controls_Manager::COLOR,
732 'selectors' => [
733 '{{WRAPPER}} .upk-alter-grid .upk-item:hover' => 'border-color: {{VALUE}};'
734 ],
735 'condition' => [
736 'item_border_border!' => ''
737 ]
738 ]
739 );
740
741 $this->add_group_control(
742 Group_Control_Box_Shadow::get_type(),
743 [
744 'name' => 'item_box_shadow_hover',
745 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item:hover',
746 ]
747 );
748
749 $this->end_controls_tab();
750
751 $this->end_controls_tabs();
752
753 $this->end_controls_section();
754
755 $this->start_controls_section(
756 'section_style_title',
757 [
758 'label' => esc_html__('Title', 'ultimate-post-kit'),
759 'tab' => Controls_Manager::TAB_STYLE,
760 'condition' => [
761 'show_title' => 'yes',
762 ],
763 ]
764 );
765
766 $this->add_control(
767 'title_style',
768 [
769 'label' => esc_html__('Style', 'ultimate-post-kit'),
770 'type' => Controls_Manager::SELECT,
771 'default' => 'underline',
772 'options' => [
773 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
774 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
775 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
776 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
777 ],
778 ]
779 );
780
781 $this->add_control(
782 'title_color',
783 [
784 'label' => esc_html__('Color', 'ultimate-post-kit'),
785 'type' => Controls_Manager::COLOR,
786 'selectors' => [
787 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'color: {{VALUE}};',
788 ],
789 ]
790 );
791
792 $this->add_control(
793 'title_hover_color',
794 [
795 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
796 'type' => Controls_Manager::COLOR,
797 'selectors' => [
798 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a:hover' => 'color: {{VALUE}};',
799 ],
800 ]
801 );
802
803 $this->add_responsive_control(
804 'title_spacing',
805 [
806 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
807 'type' => Controls_Manager::SLIDER,
808 'range' => [
809 'px' => [
810 'min' => 0,
811 'max' => 50,
812 ],
813 ],
814 'selectors' => [
815 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title' => 'margin-bottom: {{SIZE}}{{UNIT}};',
816 ],
817 ]
818 );
819
820 $this->add_group_control(
821 Group_Control_Typography::get_type(),
822 [
823 'name' => 'title_typography',
824 'label' => esc_html__('Typography', 'ultimate-post-kit'),
825 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title',
826 ]
827 );
828
829 $this->add_group_control(
830 Group_Control_Typography::get_type(),
831 [
832 'name' => 'secondary_title_typography',
833 'label' => esc_html__('Secondary Typography', 'ultimate-post-kit'),
834 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+2) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+3) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-2 .upk-item:nth-child(4n+4) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+2) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+3) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+4) .upk-title, {{WRAPPER}} .upk-alter-grid .upk-style-3 .upk-item:nth-child(5n+5) .upk-title',
835 'condition' => [
836 'grid_style' => ['2', '3']
837 ]
838 ]
839 );
840
841 $this->add_control(
842 'title_advanced_style',
843 [
844 'label' => esc_html__('Advanced Style', 'ultimate-post-kit'),
845 'type' => Controls_Manager::SWITCHER,
846 ]
847 );
848
849 $this->add_control(
850 'title_background',
851 [
852 'label' => esc_html__('Background Color', 'ultimate-post-kit'),
853 'type' => Controls_Manager::COLOR,
854 'selectors' => [
855 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'background-color: {{VALUE}};',
856 ],
857 'condition' => [
858 'title_advanced_style' => 'yes'
859 ]
860 ]
861 );
862
863 $this->add_group_control(
864 Group_Control_Text_Shadow::get_type(),
865 [
866 'name' => 'title_text_shadow',
867 'label' => esc_html__('Text Shadow', 'ultimate-post-kit'),
868 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a',
869 'condition' => [
870 'title_advanced_style' => 'yes'
871 ]
872 ]
873 );
874
875 $this->add_group_control(
876 Group_Control_Border::get_type(),
877 [
878 'name' => 'title_border',
879 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a',
880 'condition' => [
881 'title_advanced_style' => 'yes'
882 ]
883 ]
884 );
885
886 $this->add_responsive_control(
887 'title_border_radius',
888 [
889 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
890 'type' => Controls_Manager::DIMENSIONS,
891 'size_units' => ['px', '%'],
892 'selectors' => [
893 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
894 ],
895 'condition' => [
896 'title_advanced_style' => 'yes'
897 ]
898 ]
899 );
900
901 $this->add_group_control(
902 Group_Control_Box_Shadow::get_type(),
903 [
904 'name' => 'title_box_shadow',
905 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a',
906 'condition' => [
907 'title_advanced_style' => 'yes'
908 ]
909 ]
910 );
911
912 $this->add_responsive_control(
913 'title_text_padding',
914 [
915 'label' => esc_html__('Padding', 'ultimate-post-kit'),
916 'type' => Controls_Manager::DIMENSIONS,
917 'size_units' => ['px', 'em', '%'],
918 'selectors' => [
919 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
920 ],
921 'condition' => [
922 'title_advanced_style' => 'yes'
923 ]
924 ]
925 );
926
927 $this->end_controls_section();
928
929 $this->start_controls_section(
930 'section_style_text',
931 [
932 'label' => esc_html__('Text', 'ultimate-post-kit'),
933 'tab' => Controls_Manager::TAB_STYLE,
934 'condition' => [
935 'show_excerpt' => 'yes',
936 ],
937 ]
938 );
939
940 $this->add_control(
941 'text_color',
942 [
943 'label' => esc_html__('Color', 'ultimate-post-kit'),
944 'type' => Controls_Manager::COLOR,
945 'selectors' => [
946 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-text-wrap .upk-text' => 'color: {{VALUE}};',
947 ],
948 ]
949 );
950
951 $this->add_group_control(
952 Group_Control_Typography::get_type(),
953 [
954 'name' => 'text_typography',
955 'label' => esc_html__('Typography', 'ultimate-post-kit'),
956 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-text-wrap .upk-text',
957 ]
958 );
959
960 $this->add_responsive_control(
961 'text_margin',
962 [
963 'label' => esc_html__('Margin', 'ultimate-post-kit'),
964 'type' => Controls_Manager::DIMENSIONS,
965 'size_units' => ['px', 'em', '%'],
966 'selectors' => [
967 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-text-wrap .upk-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
968 ]
969 ]
970 );
971
972 $this->end_controls_section();
973
974 $this->start_controls_section(
975 'section_style_meta',
976 [
977 'label' => esc_html__('Meta', 'ultimate-post-kit'),
978 'tab' => Controls_Manager::TAB_STYLE,
979 'conditions' => [
980 'relation' => 'or',
981 'terms' => [
982 [
983 'name' => 'show_author',
984 'value' => 'yes'
985 ],
986 [
987 'name' => 'show_date',
988 'value' => 'yes'
989 ]
990 ]
991 ],
992 ]
993 );
994
995 $this->add_control(
996 'meta_color',
997 [
998 'label' => esc_html__('Color', 'ultimate-post-kit'),
999 'type' => Controls_Manager::COLOR,
1000 'selectors' => [
1001 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-meta .upk-blog-author a, {{WRAPPER}} .upk-alter-grid .upk-item .upk-meta' => 'color: {{VALUE}};',
1002 ],
1003 ]
1004 );
1005
1006 $this->add_control(
1007 'meta_hover_color',
1008 [
1009 'label' => esc_html__('Hover Color', 'ultimate-post-kit'),
1010 'type' => Controls_Manager::COLOR,
1011 'selectors' => [
1012 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-meta .upk-blog-author a:hover' => 'color: {{VALUE}};',
1013 ],
1014 ]
1015 );
1016
1017 $this->add_responsive_control(
1018 'meta_spacing',
1019 [
1020 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
1021 'type' => Controls_Manager::SLIDER,
1022 'range' => [
1023 'px' => [
1024 'min' => 0,
1025 'max' => 50,
1026 ],
1027 ],
1028 'selectors' => [
1029 '{{WRAPPER}} .upk-alter-grid .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
1030 ],
1031 ]
1032 );
1033
1034 $this->add_group_control(
1035 Group_Control_Typography::get_type(),
1036 [
1037 'name' => 'meta_typography',
1038 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1039 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-meta',
1040 ]
1041 );
1042
1043 $this->end_controls_section();
1044
1045 $this->start_controls_section(
1046 'section_style_category',
1047 [
1048 'label' => esc_html__('Category', 'ultimate-post-kit'),
1049 'tab' => Controls_Manager::TAB_STYLE,
1050 'condition' => [
1051 'show_category' => 'yes',
1052 ],
1053 ]
1054 );
1055
1056 $this->add_responsive_control(
1057 'category_spacing',
1058 [
1059 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
1060 'type' => Controls_Manager::SLIDER,
1061 'range' => [
1062 'px' => [
1063 'min' => 0,
1064 'max' => 50,
1065 ],
1066 ],
1067 'selectors' => [
1068 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category' => 'margin-bottom: {{SIZE}}{{UNIT}};',
1069 ],
1070 ]
1071 );
1072
1073 $this->start_controls_tabs('tabs_category_style');
1074
1075 $this->start_controls_tab(
1076 'tab_category_normal',
1077 [
1078 'label' => esc_html__('Normal', 'ultimate-post-kit'),
1079 ]
1080 );
1081
1082 $this->add_control(
1083 'category_color',
1084 [
1085 'label' => esc_html__('Color', 'ultimate-post-kit'),
1086 'type' => Controls_Manager::COLOR,
1087 'selectors' => [
1088 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a' => 'color: {{VALUE}};',
1089 ],
1090 ]
1091 );
1092
1093 $this->add_group_control(
1094 Group_Control_Background::get_type(),
1095 [
1096 'name' => 'category_background',
1097 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a',
1098 ]
1099 );
1100
1101 $this->add_group_control(
1102 Group_Control_Border::get_type(),
1103 [
1104 'name' => 'category_border',
1105 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a',
1106 ]
1107 );
1108
1109 $this->add_responsive_control(
1110 'category_border_radius',
1111 [
1112 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
1113 'type' => Controls_Manager::DIMENSIONS,
1114 'size_units' => ['px', '%'],
1115 'selectors' => [
1116 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1117 ],
1118 ]
1119 );
1120
1121 $this->add_responsive_control(
1122 'category_padding',
1123 [
1124 'label' => esc_html__('Padding', 'ultimate-post-kit'),
1125 'type' => Controls_Manager::DIMENSIONS,
1126 'size_units' => ['px', 'em', '%'],
1127 'selectors' => [
1128 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1129 ],
1130 ]
1131 );
1132
1133 $this->add_responsive_control(
1134 'category_margin',
1135 [
1136 'label' => esc_html__('Margin', 'ultimate-post-kit'),
1137 'type' => Controls_Manager::DIMENSIONS,
1138 'size_units' => ['px', 'em', '%'],
1139 'selectors' => [
1140 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1141 ],
1142 ]
1143 );
1144
1145 $this->add_responsive_control(
1146 'category_spacing_between',
1147 [
1148 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
1149 'type' => Controls_Manager::SLIDER,
1150 'range' => [
1151 'px' => [
1152 'min' => 0,
1153 'max' => 50,
1154 ],
1155 ],
1156 'selectors' => [
1157 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
1158 ],
1159 ]
1160 );
1161
1162
1163 $this->add_group_control(
1164 Group_Control_Box_Shadow::get_type(),
1165 [
1166 'name' => 'category_shadow',
1167 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a',
1168 ]
1169 );
1170
1171 $this->add_group_control(
1172 Group_Control_Typography::get_type(),
1173 [
1174 'name' => 'category_typography',
1175 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1176 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a',
1177 ]
1178 );
1179
1180 $this->end_controls_tab();
1181
1182 $this->start_controls_tab(
1183 'tab_category_hover',
1184 [
1185 'label' => esc_html__('Hover', 'ultimate-post-kit'),
1186 ]
1187 );
1188
1189 $this->add_control(
1190 'category_hover_color',
1191 [
1192 'label' => esc_html__('Color', 'ultimate-post-kit'),
1193 'type' => Controls_Manager::COLOR,
1194 'selectors' => [
1195 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a:hover' => 'color: {{VALUE}};',
1196 ],
1197 ]
1198 );
1199
1200 $this->add_group_control(
1201 Group_Control_Background::get_type(),
1202 [
1203 'name' => 'category_hover_background',
1204 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a:hover',
1205 ]
1206 );
1207
1208 $this->add_control(
1209 'category_hover_border_color',
1210 [
1211 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1212 'type' => Controls_Manager::COLOR,
1213 'condition' => [
1214 'category_border_border!' => '',
1215 ],
1216 'selectors' => [
1217 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-category a:hover' => 'border-color: {{VALUE}};',
1218 ],
1219 ]
1220 );
1221
1222 $this->end_controls_tab();
1223
1224 $this->end_controls_tabs();
1225
1226 $this->end_controls_section();
1227
1228 if (_is_upk_pro_activated()) {
1229 $this->start_controls_section(
1230 'section_style_readmore',
1231 [
1232 'label' => esc_html__('Read More', 'ultimate-post-kit'),
1233 'tab' => Controls_Manager::TAB_STYLE,
1234 'condition' => [
1235 'readmore_type' => 'classic',
1236 ],
1237 ]
1238 );
1239
1240 $this->start_controls_tabs('tabs_readmore_style');
1241
1242 $this->start_controls_tab(
1243 'tab_readmore_normal',
1244 [
1245 'label' => esc_html__('Normal', 'ultimate-post-kit'),
1246 ]
1247 );
1248
1249 $this->add_control(
1250 'readmore_color',
1251 [
1252 'label' => esc_html__('Color', 'ultimate-post-kit'),
1253 'type' => Controls_Manager::COLOR,
1254 'selectors' => [
1255 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore' => 'color: {{VALUE}};',
1256 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore svg *' => 'fill: {{VALUE}};',
1257 ],
1258 ]
1259 );
1260
1261 $this->add_group_control(
1262 Group_Control_Background::get_type(),
1263 [
1264 'name' => 'readmore_background',
1265 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore',
1266 ]
1267 );
1268
1269 $this->add_group_control(
1270 Group_Control_Border::get_type(),
1271 [
1272 'name' => 'readmore_border',
1273 'label' => esc_html__('Border', 'ultimate-post-kit'),
1274 'placeholder' => '1px',
1275 'default' => '1px',
1276 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore',
1277 ]
1278 );
1279
1280 $this->add_responsive_control(
1281 'readmore_border_radius',
1282 [
1283 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
1284 'type' => Controls_Manager::DIMENSIONS,
1285 'size_units' => ['px', '%'],
1286 'selectors' => [
1287 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1288 ],
1289 ]
1290 );
1291
1292 $this->add_responsive_control(
1293 'readmore_padding',
1294 [
1295 'label' => esc_html__('Padding', 'ultimate-post-kit'),
1296 'type' => Controls_Manager::DIMENSIONS,
1297 'size_units' => ['px', 'em', '%'],
1298 'selectors' => [
1299 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1300 ],
1301 ]
1302 );
1303
1304 $this->add_responsive_control(
1305 'readmore_margin',
1306 [
1307 'label' => esc_html__('Margin', 'ultimate-post-kit'),
1308 'type' => Controls_Manager::DIMENSIONS,
1309 'size_units' => ['px', 'em', '%'],
1310 'selectors' => [
1311 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1312 ]
1313 ]
1314 );
1315
1316 $this->add_group_control(
1317 Group_Control_Box_Shadow::get_type(),
1318 [
1319 'name' => 'readmore_shadow',
1320 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore',
1321 ]
1322 );
1323
1324 $this->add_group_control(
1325 Group_Control_Typography::get_type(),
1326 [
1327 'name' => 'readmore_typography',
1328 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1329 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore',
1330 ]
1331 );
1332
1333 $this->end_controls_tab();
1334
1335 $this->start_controls_tab(
1336 'tab_readmore_hover',
1337 [
1338 'label' => esc_html__('Hover', 'ultimate-post-kit'),
1339 ]
1340 );
1341
1342 $this->add_control(
1343 'readmore_hover_color',
1344 [
1345 'label' => esc_html__('Color', 'ultimate-post-kit'),
1346 'type' => Controls_Manager::COLOR,
1347 'selectors' => [
1348 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore:hover' => 'color: {{VALUE}};',
1349 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore:hover svg *' => 'fill: {{VALUE}};',
1350 ],
1351 ]
1352 );
1353
1354 $this->add_group_control(
1355 Group_Control_Background::get_type(),
1356 [
1357 'name' => 'readmore_hover_background',
1358 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore:hover',
1359 ]
1360 );
1361
1362 $this->add_control(
1363 'readmore_hover_border_color',
1364 [
1365 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1366 'type' => Controls_Manager::COLOR,
1367 'condition' => [
1368 'readmore_border_border!' => '',
1369 ],
1370 'selectors' => [
1371 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore:hover' => 'border-color: {{VALUE}};',
1372 ],
1373 ]
1374 );
1375
1376 $this->add_control(
1377 'readmore_hover_animation',
1378 [
1379 'label' => esc_html__('Animation', 'ultimate-post-kit'),
1380 'type' => Controls_Manager::HOVER_ANIMATION,
1381 ]
1382 );
1383
1384 $this->end_controls_tab();
1385
1386 $this->end_controls_tabs();
1387
1388 $this->end_controls_section();
1389
1390 $this->start_controls_section(
1391 'section_style_readmore_on_image',
1392 [
1393 'label' => esc_html__('Read More On Image', 'ultimate-post-kit'),
1394 'tab' => Controls_Manager::TAB_STYLE,
1395 'condition' => [
1396 'readmore_type' => 'on_image',
1397 ],
1398 ]
1399 );
1400
1401 $this->add_control(
1402 'readmore_on_image_color',
1403 [
1404 'label' => esc_html__('Color', 'ultimate-post-kit'),
1405 'type' => Controls_Manager::COLOR,
1406 'selectors' => [
1407 '{{WRAPPER}} .upk-alter-grid .upk-readmore-on-image .upk-readmore-icon:before, {{WRAPPER}} .upk-alter-grid .upk-item:hover .upk-readmore-on-image .upk-readmore-icon span:before, {{WRAPPER}} .upk-alter-grid .upk-item:hover .upk-readmore-on-image .upk-readmore-icon span:after' => 'background: {{VALUE}};',
1408 ],
1409 ]
1410 );
1411
1412 $this->add_control(
1413 'item_image_overlay_color',
1414 [
1415 'label' => esc_html__('Overlay Color', 'ultimate-post-kit'),
1416 'type' => Controls_Manager::COLOR,
1417 'selectors' => [
1418 '{{WRAPPER}} .upk-alter-grid .upk-readmore-on-image:before' => 'background: linear-gradient(0deg, {{VALUE}} 0, rgba(141, 153, 174, 0.1) 100%);',
1419 ],
1420 ]
1421 );
1422
1423 $this->end_controls_section();
1424 }
1425
1426 $this->start_controls_section(
1427 'section_style_post_format',
1428 [
1429 'label' => esc_html__('Post Format', 'ultimate-post-kit'),
1430 'tab' => Controls_Manager::TAB_STYLE,
1431 'condition' => [
1432 'show_post_format' => 'yes',
1433 ],
1434 ]
1435 );
1436
1437 $this->start_controls_tabs('tabs_post_format_style');
1438
1439 $this->start_controls_tab(
1440 'tab_post_format_normal',
1441 [
1442 'label' => esc_html__('Normal', 'ultimate-post-kit'),
1443 ]
1444 );
1445
1446 $this->add_control(
1447 'post_format_color',
1448 [
1449 'label' => esc_html__('Color', 'ultimate-post-kit'),
1450 'type' => Controls_Manager::COLOR,
1451 'selectors' => [
1452 '{{WRAPPER}} .upk-alter-grid .upk-post-format a' => 'color: {{VALUE}};',
1453 ],
1454 ]
1455 );
1456
1457 $this->add_group_control(
1458 Group_Control_Background::get_type(),
1459 [
1460 'name' => 'post_format_background',
1461 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-post-format a',
1462 ]
1463 );
1464
1465 $this->add_group_control(
1466 Group_Control_Border::get_type(),
1467 [
1468 'name' => 'post_format_border',
1469 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-post-format a',
1470 ]
1471 );
1472
1473 $this->add_responsive_control(
1474 'post_format_border_radius',
1475 [
1476 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
1477 'type' => Controls_Manager::DIMENSIONS,
1478 'size_units' => ['px', '%'],
1479 'selectors' => [
1480 '{{WRAPPER}} .upk-alter-grid .upk-post-format a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1481 ],
1482 ]
1483 );
1484
1485 $this->add_responsive_control(
1486 'post_format_padding',
1487 [
1488 'label' => esc_html__('Padding', 'ultimate-post-kit'),
1489 'type' => Controls_Manager::DIMENSIONS,
1490 'size_units' => ['px', 'em', '%'],
1491 'selectors' => [
1492 '{{WRAPPER}} .upk-alter-grid .upk-post-format a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1493 ],
1494 ]
1495 );
1496
1497 $this->add_responsive_control(
1498 'post_format_margin',
1499 [
1500 'label' => esc_html__('Margin', 'ultimate-post-kit'),
1501 'type' => Controls_Manager::DIMENSIONS,
1502 'size_units' => ['px', 'em', '%'],
1503 'selectors' => [
1504 '{{WRAPPER}} .upk-alter-grid .upk-post-format a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1505 ],
1506 ]
1507 );
1508
1509 $this->add_group_control(
1510 Group_Control_Box_Shadow::get_type(),
1511 [
1512 'name' => 'post_format_shadow',
1513 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-post-format a',
1514 ]
1515 );
1516
1517 $this->add_group_control(
1518 Group_Control_Typography::get_type(),
1519 [
1520 'name' => 'post_format_typography',
1521 'label' => esc_html__('Typography', 'ultimate-post-kit'),
1522 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-post-format a',
1523 ]
1524 );
1525
1526 $this->end_controls_tab();
1527
1528 $this->start_controls_tab(
1529 'tab_post_format_hover',
1530 [
1531 'label' => esc_html__('Hover', 'ultimate-post-kit'),
1532 ]
1533 );
1534
1535 $this->add_control(
1536 'post_format_hover_color',
1537 [
1538 'label' => esc_html__('Color', 'ultimate-post-kit'),
1539 'type' => Controls_Manager::COLOR,
1540 'selectors' => [
1541 '{{WRAPPER}} .upk-alter-grid .upk-post-format a:hover' => 'color: {{VALUE}};',
1542 ],
1543 ]
1544 );
1545
1546 $this->add_group_control(
1547 Group_Control_Background::get_type(),
1548 [
1549 'name' => 'post_format_hover_background',
1550 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-post-format a:hover',
1551 ]
1552 );
1553
1554 $this->add_control(
1555 'post_format_hover_border_color',
1556 [
1557 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
1558 'type' => Controls_Manager::COLOR,
1559 'condition' => [
1560 'post_format_border_border!' => '',
1561 ],
1562 'selectors' => [
1563 '{{WRAPPER}} .upk-alter-grid .upk-post-format a:hover' => 'border-color: {{VALUE}};',
1564 ],
1565 ]
1566 );
1567
1568 $this->end_controls_tab();
1569
1570 $this->end_controls_tabs();
1571
1572 $this->end_controls_section();
1573
1574 //Global Pagination Controls
1575 $this->register_pagination_controls();
1576
1577 //Global ajax style controls
1578 $this->register_ajax_loadmore_style_controls();
1579 }
1580
1581 /**
1582 * Get post query builder arguments
1583 */
1584 public function query_posts( $posts_per_page ) {
1585 $settings = $this->get_settings();
1586 $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1587 $args = $this->getGroupControlQueryArgs();
1588 $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1589
1590 if ( $is_current_query ) {
1591 unset( $args['offset'] );
1592 unset( $args['no_found_rows'] );
1593 $posts_per_page = 0;
1594 }
1595
1596 if ( $posts_per_page > 0 ) {
1597 $args['posts_per_page'] = $posts_per_page;
1598 } else {
1599 $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1600 }
1601
1602 if ( $settings['show_pagination'] ) {
1603 $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1604 }
1605
1606 $this->_query = new \WP_Query( $args );
1607 }
1608
1609 public function render_readmore() {
1610 $settings = $this->get_settings_for_display();
1611
1612 $animation = ($this->get_settings('readmore_hover_animation')) ? ' elementor-animation-' . $this->get_settings('readmore_hover_animation') : '';
1613
1614 ?>
1615
1616 <a
1617 href="<?php echo esc_url(get_permalink()); ?>"
1618 class="upk-readmore upk-display-inline-block <?php echo esc_attr($animation); ?>"
1619 aria-label="<?php echo esc_attr__( 'Read More Button', 'ultimate-post-kit' ); ?>"
1620 >
1621 <?php echo esc_html($this->get_settings('readmore_text')); ?>
1622
1623 <?php if ($settings['readmore_icon']['value']) : ?>
1624 <span class="upk-button-icon-align-<?php echo esc_attr($this->get_settings('readmore_icon_align')); ?>">
1625 <?php Icons_Manager::render_icon($settings['readmore_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?>
1626 </span>
1627 <?php endif; ?>
1628 </a>
1629 <?php
1630 }
1631
1632 public function render_readmore_on_image() {
1633
1634 ?>
1635 <a
1636 href="<?php echo esc_url(get_permalink()); ?>"
1637 class="upk-readmore-on-image"
1638 aria-label="<?php echo esc_attr__( 'Read More Button', 'ultimate-post-kit' ); ?>"
1639 >
1640 <span class="upk-readmore-icon"><span></span></span>
1641 </a>
1642 <?php
1643 }
1644
1645 public function render_post_grid_item($post_id, $image_size, $excerpt_length) {
1646 $settings = $this->get_settings_for_display();
1647
1648 if ('yes' == $settings['global_link']) {
1649
1650 $this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true);
1651 }
1652 $this->add_render_attribute('grid-item', 'class', 'upk-item', true);
1653
1654 ?>
1655 <div <?php $this->print_render_attribute_string('grid-item'); ?>>
1656 <div class="upk-item-box">
1657 <div class="upk-img-wrap">
1658 <div class="upk-main-img">
1659 <?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?>
1660 <?php if (_is_upk_pro_activated()) : ?>
1661 <?php if ($settings['readmore_type'] == 'on_image') : ?>
1662 <?php $this->render_readmore_on_image(); ?>
1663 <?php endif; ?>
1664 <?php endif; ?>
1665 <?php $this->render_post_format(); ?>
1666 </div>
1667 </div>
1668
1669 <div class="upk-content">
1670 <div>
1671
1672 <?php $this->render_category(); ?>
1673
1674 <?php $this->render_title(substr($this->get_name(), 4)); ?>
1675 <div class="upk-text-wrap">
1676 <?php $this->render_excerpt($excerpt_length); ?>
1677 <?php if (_is_upk_pro_activated()) : ?>
1678 <?php if ($settings['readmore_type'] == 'classic') : ?>
1679 <?php $this->render_readmore(); ?>
1680 <?php endif; ?>
1681 <?php endif; ?>
1682 </div>
1683
1684 <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
1685 <div class="upk-meta">
1686 <?php if ($settings['show_author']) : ?>
1687 <div class="upk-blog-author" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1688 <a
1689 class="author-name"
1690 href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"
1691 aria-label="<?php echo esc_attr( 'View all posts by ' . get_the_author() ); ?>"
1692 >
1693 <?php echo esc_html( get_the_author() ) ?>
1694 </a>
1695 </div>
1696 <?php endif; ?>
1697 <?php if ('yes' === $settings['show_date']) : ?>
1698 <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1699 <?php $this->render_date(); ?>
1700 </div>
1701 <?php endif; ?>
1702
1703 <?php if (_is_upk_pro_activated()) :
1704 if ('yes' === $settings['show_reading_time']) : ?>
1705 <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1706 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1707 </div>
1708 <?php endif; ?>
1709 <?php endif; ?>
1710 </div>
1711 <?php endif; ?>
1712
1713 </div>
1714 </div>
1715
1716 </div>
1717 </div>
1718 <?php
1719 }
1720
1721 protected function render() {
1722 $settings = $this->get_settings_for_display();
1723
1724 if ($settings['grid_style'] == '2') {
1725 $this->query_posts($settings['item_limit_2']['size']);
1726 } elseif ($settings['grid_style'] == '3') {
1727 $this->query_posts($settings['item_limit_3']['size']);
1728 } else {
1729 $this->query_posts($settings['item_limit']['size']);
1730 }
1731
1732 $wp_query = $this->get_query();
1733
1734 if (!$wp_query->have_posts()) {
1735 return;
1736 }
1737
1738 $this->add_render_attribute('grid-wrap', 'class', 'upk-post-grid upk-ajax-grid-wrap');
1739 $this->add_render_attribute('grid-wrap', 'class', 'upk-style-' . $settings['grid_style']);
1740
1741 $this->add_render_attribute(
1742 [
1743 'upk-alter-grid' => [
1744 'class' => 'upk-alter-grid upk-ajax-grid',
1745 'data-loadmore' => [
1746 wp_json_encode(
1747 array_filter([
1748 'loadmore_enable' => $settings['ajax_loadmore_enable'],
1749 'loadmore_btn' => $settings['ajax_loadmore_btn'],
1750 'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'],
1751 ])
1752 ),
1753 ],
1754 ],
1755 ]
1756 );
1757
1758 if ( $settings['ajax_loadmore_enable'] == 'yes' ) {
1759 $ajax_settings = [
1760 'posts_source' => isset( $settings['posts_source'] ) ? $settings['posts_source'] : 'post',
1761 'posts_per_page' => isset( $posts_load ) ? $posts_load : 6,
1762 'ajax_item_load' => isset( $settings['ajax_loadmore_items'] ) ? $settings['ajax_loadmore_items'] : 3,
1763 'posts_selected_ids' => isset( $settings['posts_selected_ids'] ) ? $settings['posts_selected_ids'] : '',
1764 'posts_include_by' => isset( $settings['posts_include_by'] ) ? $settings['posts_include_by'] : [],
1765 'posts_include_author_ids' => isset( $settings['posts_include_author_ids'] ) ? $settings['posts_include_author_ids'] : '',
1766 'posts_include_term_ids' => isset( $settings['posts_include_term_ids'] ) ? $settings['posts_include_term_ids'] : '',
1767 'posts_exclude_by' => isset( $settings['posts_exclude_by'] ) ? $settings['posts_exclude_by'] : [],
1768 'posts_exclude_ids' => isset( $settings['posts_exclude_ids'] ) ? $settings['posts_exclude_ids'] : '',
1769 'posts_exclude_author_ids' => isset( $settings['posts_exclude_author_ids'] ) ? $settings['posts_exclude_author_ids'] : '',
1770 'posts_exclude_term_ids' => isset( $settings['posts_exclude_term_ids'] ) ? $settings['posts_exclude_term_ids'] : '',
1771 'posts_offset' => isset( $settings['posts_offset'] ) ? $settings['posts_offset'] : 0,
1772 'posts_select_date' => isset( $settings['posts_select_date'] ) ? $settings['posts_select_date'] : '',
1773 'posts_date_before' => isset( $settings['posts_date_before'] ) ? $settings['posts_date_before'] : '',
1774 'posts_date_after' => isset( $settings['posts_date_after'] ) ? $settings['posts_date_after'] : '',
1775 'posts_orderby' => isset( $settings['posts_orderby'] ) ? $settings['posts_orderby'] : 'date',
1776 'posts_order' => isset( $settings['posts_order'] ) ? $settings['posts_order'] : 'DESC',
1777 'posts_ignore_sticky_posts' => isset( $settings['posts_ignore_sticky_posts'] ) ? $settings['posts_ignore_sticky_posts'] : 'no',
1778 'posts_only_with_featured_image'=> isset( $settings['posts_only_with_featured_image'] ) ? $settings['posts_only_with_featured_image'] : 'no',
1779 // Grid Settings
1780 'show_title' => isset( $settings['show_title'] ) ? $settings['show_title'] : 'yes',
1781 'title_tags' => isset( $settings['title_tags'] ) ? $settings['title_tags'] : 'h3',
1782 'show_excerpt' => isset( $settings['show_excerpt'] ) ? $settings['show_excerpt'] : 'yes',
1783 'show_author' => isset( $settings['show_author'] ) ? $settings['show_author'] : 'yes',
1784 'show_date' => isset( $settings['show_date'] ) ? $settings['show_date'] : 'yes',
1785 'show_time' => isset( $settings['show_time'] ) ? $settings['show_time'] : 'no',
1786 'upk_link_new_tab' => isset( $settings['upk_link_new_tab'] ) ? $settings['upk_link_new_tab'] : 'no',
1787 'show_category' => isset( $settings['show_category'] ) ? $settings['show_category'] : 'yes',
1788 'content_on_image' => isset( $settings['content_on_image'] ) ? $settings['content_on_image'] : 'no',
1789 'readmore_type' => isset( $settings['readmore_type'] ) ? $settings['readmore_type'] : 'none',
1790 'readmore_text' => isset( $settings['readmore_text'] ) ? $settings['readmore_text'] : 'Read More',
1791 'readmore_icon' => isset( $settings['readmore_icon'] ) ? $settings['readmore_icon'] : '',
1792 'readmore_icon_align' => isset( $settings['readmore_icon_align'] ) ? $settings['readmore_icon_align'] : 'right',
1793 'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no',
1794 'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200,
1795 'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no',
1796 'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no',
1797 'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '|',
1798 'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no',
1799 'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no',
1800 'show_post_format' => isset( $settings['show_post_format'] ) ? $settings['show_post_format'] : 'no',
1801 'excerpt_length' => isset( $settings['excerpt_length'] ) ? $settings['excerpt_length'] : 20,
1802 'title_style' => isset( $settings['title_style'] ) ? $settings['title_style'] : 'underline',
1803 'global_link' => isset( $settings['global_link'] ) ? $settings['global_link'] : 'no',
1804 ];
1805
1806 $this->add_render_attribute(
1807 [
1808 'upk-alter-grid' => [
1809 'data-settings' => [
1810 wp_json_encode( $ajax_settings ),
1811 ],
1812 ],
1813 ]
1814 );
1815 }
1816
1817 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
1818 $this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation');
1819 if (isset($settings['upk_in_animation_delay']['size'])) {
1820 $this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']);
1821 }
1822 }
1823
1824 ?>
1825
1826 <div <?php $this->print_render_attribute_string('upk-alter-grid'); ?>>
1827 <div <?php $this->print_render_attribute_string('grid-wrap'); ?>>
1828
1829 <?php while ($wp_query->have_posts()) :
1830 $wp_query->the_post();
1831
1832 $thumbnail_size = $settings['primary_thumbnail_size'];
1833
1834 ?>
1835
1836 <?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $settings['excerpt_length']); ?>
1837
1838 <?php endwhile; ?>
1839 </div>
1840 </div>
1841
1842 <?php $this->render_ajax_loadmore(); ?>
1843
1844 <?php
1845
1846 if ($settings['show_pagination']) { ?>
1847 <div class="ep-pagination">
1848 <?php ultimate_post_kit_post_pagination($wp_query, $this->get_id()); ?>
1849 </div>
1850 <?php
1851 }
1852 wp_reset_postdata();
1853 }
1854 }
1855