PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.11
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.11
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.1.11, at modules/alter-grid/widgets/alter-grid.php

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