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

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