PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.1.1
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.1.1
4.5.6 4.5.5 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 All 148 releases
ultimate-post-kit / modules / exotic-list / widgets / exotic-list.php

exotic-list.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.1.1, at modules/exotic-list/widgets/exotic-list.php

895 lines 23.3 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\ExoticList\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
13 use UltimatePostKit\Traits\Global_Widget_Controls;
14 use UltimatePostKit\Traits\Global_Widget_Functions;
15 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
16 use WP_Query;
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 } // Exit if accessed directly
21
22 class Exotic_List extends Group_Control_Query {
23
24 use Global_Widget_Controls;
25 use Global_Widget_Functions;
26
27 private $_query = null;
28
29 public function get_name() {
30 return 'upk-exotic-list';
31 }
32
33 public function get_title() {
34 return BDTUPK . esc_html__( 'Exotic List', 'ultimate-post-kit' );
35 }
36
37 public function get_icon() {
38 return 'upk-widget-icon upk-icon-exotic-list upk-new';
39 }
40
41 public function get_categories() {
42 return [ 'ultimate-post-kit' ];
43 }
44
45 public function get_keywords() {
46 return [ 'post', 'grid', 'blog', 'recent', 'news', 'exotic', 'list' ];
47 }
48
49 public function get_style_depends() {
50 if ( $this->upk_is_edit_mode() ) {
51 return [ 'upk-all-styles' ];
52 } else {
53 return [ 'upk-font', 'upk-exotic-list' ];
54 }
55 }
56
57 public function get_custom_help_url() {
58 return 'https://youtu.be/WROTolCKOmE';
59 }
60
61 public function get_query() {
62 return $this->_query;
63 }
64
65 public function has_widget_inner_wrapper(): bool {
66 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
67 }
68
69
70 protected function register_controls() {
71 $this->start_controls_section(
72 'section_content_layout',
73 [
74 'label' => esc_html__( 'Layout', 'ultimate-post-kit' ),
75 ]
76 );
77
78
79 $this->add_responsive_control(
80 'row_gap',
81 [
82 'label' => esc_html__( 'Row Gap', 'ultimate-post-kit' ),
83 'type' => Controls_Manager::SLIDER,
84 'selectors' => [
85 '{{WRAPPER}} .upk-exotic-list .upk-item' => 'margin-bottom: {{SIZE}}{{UNIT}};',
86 ],
87 ]
88 );
89
90 $this->add_control(
91 'image_direction_style',
92 [
93 'label' => esc_html__('Image Direction', 'ultimate-post-kit'),
94 'type' => Controls_Manager::SELECT,
95 'default' => 'right',
96 'options' => [
97 'right' => esc_html__('Right', 'ultimate-post-kit'),
98 'left' => esc_html__('Left', 'ultimate-post-kit'),
99 ],
100 ]
101 );
102
103 $this->add_responsive_control(
104 'content_alignment',
105 [
106 'label' => __('Alignment', 'ultimate-post-kit'),
107 'type' => Controls_Manager::CHOOSE,
108 'options' => [
109 'left' => [
110 'title' => __('Left', 'ultimate-post-kit'),
111 'icon' => 'eicon-h-align-left',
112 ],
113 'center' => [
114 'title' => __('Center', 'ultimate-post-kit'),
115 'icon' => 'eicon-h-align-center',
116 ],
117 'right' => [
118 'title' => __('Right', 'ultimate-post-kit'),
119 'icon' => 'eicon-h-align-right',
120 ],
121 ],
122 'selectors' => [
123 '{{WRAPPER}} .upk-exotic-list .upk-content-wrap' => 'text-align: {{VALUE}};',
124 ],
125 ]
126 );
127
128 $this->add_group_control(
129 Group_Control_Image_Size::get_type(),
130 [
131 'name' => 'primary_thumbnail',
132 'exclude' => [ 'custom' ],
133 'default' => 'medium',
134 ]
135 );
136
137 $this->end_controls_section();
138
139 // Query Settings
140 $this->start_controls_section(
141 'section_post_query_builder',
142 [
143 'label' => __( 'Query', 'ultimate-post-kit' ),
144 'tab' => Controls_Manager::TAB_CONTENT,
145 ]
146 );
147
148 $this->add_control(
149 'item_limit',
150 [
151 'label' => esc_html__( 'Item Limit', 'ultimate-post-kit' ),
152 'type' => Controls_Manager::SLIDER,
153 'range' => [
154 'px' => [
155 'min' => 1,
156 'max' => 20,
157 ],
158 ],
159 'default' => [
160 'size' => 3,
161 ],
162 ]
163 );
164
165 $this->register_query_builder_controls();
166
167 $this->end_controls_section();
168
169 $this->start_controls_section(
170 'section_content_additional',
171 [
172 'label' => esc_html__( 'Additional Options', 'ultimate-post-kit' ),
173 ]
174 );
175
176 $this->add_control(
177 'show_image',
178 [
179 'label' => esc_html__( 'Show Image', 'ultimate-post-kit' ),
180 'type' => Controls_Manager::SWITCHER,
181 'default' => 'yes',
182 ]
183 );
184
185 //Global Title Controls
186 $this->register_title_controls();
187
188 $this->add_control(
189 'show_category',
190 [
191 'label' => esc_html__( 'Show Category', 'ultimate-post-kit' ),
192 'type' => Controls_Manager::SWITCHER,
193 'default' => 'yes',
194 ]
195 );
196
197 $this->add_control(
198 'show_author',
199 [
200 'label' => esc_html__( 'Show Author', 'ultimate-post-kit' ),
201 'type' => Controls_Manager::SWITCHER,
202 'default' => 'yes',
203 ]
204 );
205
206 $this->add_control(
207 'meta_separator',
208 [
209 'label' => __('Separator', 'ultimate-post-kit'),
210 'type' => Controls_Manager::TEXT,
211 'default' => '//',
212 'label_block' => false,
213 'conditions' => [
214 'relation' => 'or',
215 'terms' => [
216 [
217 'name' => 'show_category',
218 'operator' => '===',
219 'value' => 'yes',
220 ],
221 [
222 'name' => 'show_author',
223 'operator' => '===',
224 'value' => 'yes',
225 ],
226 ],
227 ],
228 ]
229 );
230
231 //Global Date Controls
232 $this->register_date_controls();
233
234 //Global Reading Time Controls
235 $this->register_reading_time_controls();
236
237 $this->add_control(
238 'show_pagination',
239 [
240 'label' => esc_html__( 'Show Pagination', 'ultimate-post-kit' ),
241 'type' => Controls_Manager::SWITCHER,
242 'separator' => 'before'
243 ]
244 );
245
246 $this->add_control(
247 'global_link',
248 [
249 'label' => __( 'Item Wrapper Link', 'ultimate-post-kit' ),
250 'type' => Controls_Manager::SWITCHER,
251 'prefix_class' => 'upk-global-link-',
252 'description' => __( 'Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit' ),
253 ]
254 );
255
256 $this->end_controls_section();
257
258 $this->start_controls_section(
259 'section_style_image',
260 [
261 'label' => esc_html__( 'Image', 'ultimate-post-kit' ),
262 'tab' => Controls_Manager::TAB_STYLE,
263 'condition' => [
264 'show_image' => 'yes'
265 ]
266 ]
267 );
268
269 $this->add_responsive_control(
270 'content_gap',
271 [
272 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
273 'type' => Controls_Manager::SLIDER,
274 'selectors' => [
275 '{{WRAPPER}} .upk-exotic-list .upk-content-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
276 ],
277 ]
278 );
279
280 $this->add_group_control(
281 Group_Control_Border::get_type(),
282 [
283 'name' => 'item_image_border',
284 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-image-wrap',
285 ]
286 );
287
288 $this->add_responsive_control(
289 'item_image_border_radius',
290 [
291 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
292 'type' => Controls_Manager::DIMENSIONS,
293 'size_units' => [ 'px', '%' ],
294 'selectors' => [
295 '{{WRAPPER}} .upk-exotic-list .upk-image-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
296 ],
297 ]
298 );
299
300 $this->add_responsive_control(
301 'item_image_height',
302 [
303 'label' => esc_html__( 'Height', 'ultimate-post-kit' ),
304 'type' => Controls_Manager::SLIDER,
305 'range' => [
306 'px' => [
307 'min' => 100,
308 'max' => 500,
309 ],
310 ],
311 'selectors' => [
312 '{{WRAPPER}} .upk-exotic-list' => 'height: {{SIZE}}{{UNIT}};',
313 ],
314 ]
315 );
316
317 $this->end_controls_section();
318
319 $this->start_controls_section(
320 'section_style_title',
321 [
322 'label' => esc_html__( 'Title', 'ultimate-post-kit' ),
323 'tab' => Controls_Manager::TAB_STYLE,
324 'condition' => [
325 'show_title' => 'yes',
326 ],
327 ]
328 );
329
330 $this->add_control(
331 'title_style',
332 [
333 'label' => esc_html__('Style', 'ultimate-post-kit'),
334 'type' => Controls_Manager::SELECT,
335 'default' => 'underline',
336 'options' => [
337 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
338 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
339 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
340 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
341 ],
342 ]
343 );
344
345 $this->add_control(
346 'title_color',
347 [
348 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
349 'type' => Controls_Manager::COLOR,
350 'selectors' => [
351 '{{WRAPPER}} .upk-exotic-list .upk-title a' => 'color: {{VALUE}};',
352 ],
353 ]
354 );
355
356 $this->add_control(
357 'title_hover_color',
358 [
359 'label' => esc_html__( 'Hover Color', 'ultimate-post-kit' ),
360 'type' => Controls_Manager::COLOR,
361 'selectors' => [
362 '{{WRAPPER}} .upk-exotic-list .upk-title a:hover' => 'color: {{VALUE}};',
363 ],
364 ]
365 );
366
367 $this->add_responsive_control(
368 'title_spacing',
369 [
370 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
371 'type' => Controls_Manager::SLIDER,
372 'range' => [
373 'px' => [
374 'min' => 0,
375 'max' => 50,
376 ],
377 ],
378 'selectors' => [
379 '{{WRAPPER}} .upk-exotic-list .upk-title' => 'padding-bottom: {{SIZE}}{{UNIT}};',
380 ],
381 ]
382 );
383
384 $this->add_group_control(
385 Group_Control_Typography::get_type(),
386 [
387 'name' => 'title_typography',
388 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
389 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-title',
390 ]
391 );
392
393 $this->add_group_control(
394 Group_Control_Text_Shadow::get_type(),
395 [
396 'name' => 'title_text_shadow',
397 'label' => __( 'Text Shadow', 'ultimate-post-kit' ),
398 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-title a',
399 ]
400 );
401
402 $this->end_controls_section();
403
404 $this->start_controls_section(
405 'section_style_date',
406 [
407 'label' => esc_html__( 'Date', 'ultimate-post-kit' ),
408 'tab' => Controls_Manager::TAB_STYLE,
409 'conditions' => [
410 'relation' => 'or',
411 'terms' => [
412 [
413 'name' => 'show_date',
414 'value' => 'yes'
415 ],
416 ]
417 ],
418 ]
419 );
420
421 $this->add_control(
422 'date_color',
423 [
424 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
425 'type' => Controls_Manager::COLOR,
426 'selectors' => [
427 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'color: {{VALUE}};',
428 ],
429 ]
430 );
431
432
433 $this->add_group_control(
434 Group_Control_Background::get_type(),
435 [
436 'name' => 'date_background',
437 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
438 ]
439 );
440
441 $this->add_group_control(
442 Group_Control_Border::get_type(),
443 [
444 'name' => 'date_border',
445 'label' => __( 'Border', 'ultimate-post-kit' ),
446 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
447 ]
448 );
449
450 $this->add_responsive_control(
451 'date_border_radius',
452 [
453 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
454 'type' => Controls_Manager::DIMENSIONS,
455 'size_units' => [ 'px', '%' ],
456 'selectors' => [
457 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
458 ],
459 ]
460 );
461
462 $this->add_responsive_control(
463 'date_padding',
464 [
465 'label' => esc_html__( 'Padding', 'ultimate-post-kit' ),
466 'type' => Controls_Manager::DIMENSIONS,
467 'size_units' => [ 'px', 'em', '%' ],
468 'selectors' => [
469 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
470 ],
471 ]
472 );
473
474
475 $this->add_responsive_control(
476 'date_spacing',
477 [
478 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
479 'type' => Controls_Manager::SLIDER,
480 'range' => [
481 'px' => [
482 'min' => 0,
483 'max' => 50,
484 'step' => 2,
485 ],
486 ],
487 'selectors' => [
488 '{{WRAPPER}} .upk-exotic-list .upk-content-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
489 ],
490 ]
491 );
492
493 $this->add_group_control(
494 Group_Control_Typography::get_type(),
495 [
496 'name' => 'date_typography',
497 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
498 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
499 ]
500 );
501
502 $this->end_controls_section();
503
504
505 $this->start_controls_section(
506 'section_style_author',
507 [
508 'label' => esc_html__( 'Author', 'ultimate-post-kit' ),
509 'tab' => Controls_Manager::TAB_STYLE,
510 'conditions' => [
511 'relation' => 'or',
512 'terms' => [
513 [
514 'name' => 'show_author',
515 'value' => 'yes'
516 ],
517 ]
518 ],
519 ]
520 );
521
522 $this->add_control(
523 'author_color',
524 [
525 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
526 'type' => Controls_Manager::COLOR,
527 'selectors' => [
528 '{{WRAPPER}} .upk-exotic-list .upk-author a' => 'color: {{VALUE}};',
529 ],
530 ]
531 );
532
533 $this->add_control(
534 'author_hover_color',
535 [
536 'label' => esc_html__( 'Hover Color', 'ultimate-post-kit' ),
537 'type' => Controls_Manager::COLOR,
538 'selectors' => [
539 '{{WRAPPER}} .upk-exotic-list .upk-author a:hover' => 'color: {{VALUE}};',
540 ],
541 ]
542 );
543
544 // $this->add_responsive_control(
545 // 'author_spacing',
546 // [
547 // 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
548 // 'type' => Controls_Manager::SLIDER,
549 // 'range' => [
550 // 'px' => [
551 // 'min' => 0,
552 // 'max' => 50,
553 // 'step' => 2,
554 // ],
555 // ],
556 // 'selectors' => [
557 // '{{WRAPPER}} .upk-exotic-list .upk-meta' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
558 // ],
559 // ]
560 // );
561 $this->add_responsive_control(
562 'author_spacing',
563 [
564 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
565 'type' => Controls_Manager::SLIDER,
566 'range' => [
567 'px' => [
568 'min' => 0,
569 'max' => 50,
570 ],
571 ],
572 'selectors' => [
573 '{{WRAPPER}} .upk-exotic-list .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
574 ],
575 ]
576 );
577
578 $this->add_group_control(
579 Group_Control_Typography::get_type(),
580 [
581 'name' => 'author_typography',
582 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
583 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-author',
584 ]
585 );
586
587 $this->end_controls_section();
588
589 $this->start_controls_section(
590 'section_style_category',
591 [
592 'label' => esc_html__( 'Category', 'ultimate-post-kit' ),
593 'tab' => Controls_Manager::TAB_STYLE,
594 'condition' => [
595 'show_category' => 'yes',
596 ],
597 ]
598 );
599
600 $this->start_controls_tabs( 'tabs_category_style' );
601
602 $this->start_controls_tab(
603 'tab_category_normal',
604 [
605 'label' => esc_html__( 'Normal', 'ultimate-post-kit' ),
606 ]
607 );
608
609 $this->add_control(
610 'category_color',
611 [
612 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
613 'type' => Controls_Manager::COLOR,
614 'selectors' => [
615 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'color: {{VALUE}};',
616 ],
617 ]
618 );
619
620 $this->add_group_control(
621 Group_Control_Background::get_type(),
622 [
623 'name' => 'category_background',
624 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
625 ]
626 );
627
628 $this->add_group_control(
629 Group_Control_Border::get_type(),
630 [
631 'name' => 'category_border',
632 'label' => __( 'Border', 'ultimate-post-kit' ),
633 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
634 ]
635 );
636
637 $this->add_responsive_control(
638 'category_border_radius',
639 [
640 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
641 'type' => Controls_Manager::DIMENSIONS,
642 'size_units' => [ 'px', '%' ],
643 'selectors' => [
644 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
645 ],
646 ]
647 );
648
649 $this->add_responsive_control(
650 'category_padding',
651 [
652 'label' => esc_html__( 'Padding', 'ultimate-post-kit' ),
653 'type' => Controls_Manager::DIMENSIONS,
654 'size_units' => [ 'px', 'em', '%' ],
655 'selectors' => [
656 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
657 ],
658 ]
659 );
660
661 $this->add_responsive_control(
662 'category_spacing',
663 [
664 'label' => esc_html__( 'Space Between', 'ultimate-post-kit' ),
665 'type' => Controls_Manager::SLIDER,
666 'range' => [
667 'px' => [
668 'min' => 0,
669 'max' => 50,
670 'step' => 2,
671 ],
672 ],
673 'selectors' => [
674 '{{WRAPPER}} .upk-exotic-list .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
675 ],
676 ]
677 );
678
679
680 $this->add_group_control(
681 Group_Control_Box_Shadow::get_type(),
682 [
683 'name' => 'category_shadow',
684 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
685 ]
686 );
687
688 $this->add_group_control(
689 Group_Control_Typography::get_type(),
690 [
691 'name' => 'category_typography',
692 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
693 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
694 ]
695 );
696
697 $this->end_controls_tab();
698
699 $this->start_controls_tab(
700 'tab_category_hover',
701 [
702 'label' => esc_html__( 'Hover', 'ultimate-post-kit' ),
703 ]
704 );
705
706 $this->add_control(
707 'category_hover_color',
708 [
709 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
710 'type' => Controls_Manager::COLOR,
711 'selectors' => [
712 '{{WRAPPER}} .upk-exotic-list .upk-category a:hover' => 'color: {{VALUE}};',
713 ],
714 ]
715 );
716
717 $this->add_group_control(
718 Group_Control_Background::get_type(),
719 [
720 'name' => 'category_hover_background',
721 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a:hover',
722 ]
723 );
724
725 $this->add_control(
726 'category_hover_border_color',
727 [
728 'label' => esc_html__( 'Border Color', 'ultimate-post-kit' ),
729 'type' => Controls_Manager::COLOR,
730 'condition' => [
731 'category_border_border!' => '',
732 ],
733 'selectors' => [
734 '{{WRAPPER}} .upk-exotic-list .upk-category a:hover' => 'border-color: {{VALUE}};',
735 ],
736 ]
737 );
738
739 $this->end_controls_tab();
740
741 $this->end_controls_tabs();
742
743 $this->end_controls_section();
744
745 //Global Pagination Controls
746 $this->register_pagination_controls();
747 }
748
749 /**
750 * Main query render for this widget
751 * @param $posts_per_page number item query limit
752 */
753 public function query_posts( $posts_per_page ) {
754
755 $default = $this->getGroupControlQueryArgs();
756 if ( $posts_per_page ) {
757 $args['posts_per_page'] = $posts_per_page;
758 $args['paged'] = max( 1, get_query_var( 'paged' ), get_query_var( 'page' ) );
759 }
760 $args = array_merge( $default, $args );
761 $this->_query = new WP_Query( $args );
762 }
763
764 public function render_author() {
765
766 if ( ! $this->get_settings( 'show_author' ) ) {
767 return;
768 }
769
770 ?>
771 <div class="upk-author">
772 <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) ?>">
773 <?php echo esc_html( get_the_author() ) ?>
774 </a>
775 </div>
776
777 <?php
778 }
779
780 public function render_date() {
781 $settings = $this->get_settings_for_display();
782
783 if ( ! $this->get_settings( 'show_date' ) ) {
784 return;
785 }
786
787 ?>
788 <div class="upk-date-wrap">
789 <span>
790 <?php if ($settings['human_diff_time'] == 'yes') {
791 echo esc_html( ultimate_post_kit_post_time_diff( ( $settings['human_diff_time_short'] == 'yes' ) ? 'short' : '' ) );
792 } else {
793 echo get_the_date();
794 } ?>
795 </span>
796 </div>
797 <?php if ($settings['show_time']) : ?>
798 <div class="upk-post-time">
799 <i class="upk-icon-clock" aria-hidden="true"></i>
800 <?php echo esc_html( get_the_time() ); ?>
801 </div>
802 <?php endif; ?>
803
804 <?php
805 }
806
807 public function render_post_grid_item( $post_id, $image_size ) {
808 $settings = $this->get_settings_for_display();
809
810 if ( 'yes' == $settings['global_link'] ) {
811
812 $this->add_render_attribute( 'list-item', 'onclick', "window.open('" . esc_url( get_permalink() ) . "', '_self')", true );
813 }
814 $this->add_render_attribute( 'list-item', 'class', 'upk-item', true );
815
816 ?>
817 <div <?php $this->print_render_attribute_string( 'list-item' ); ?>>
818
819 <div class="upk-content-wrap">
820 <?php $this->render_date(); ?>
821 <div class="upk-inner-content">
822 <?php $this->render_title(substr($this->get_name(), 4)); ?>
823 <div class="upk-meta">
824 <?php $this->render_category(); ?>
825
826 <?php if ($settings['show_author']) : ?>
827 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
828 <?php $this->render_author(); ?>
829 </div>
830 <?php endif; ?>
831 <?php if (_is_upk_pro_activated()) :
832 if ('yes' === $settings['show_reading_time']) : ?>
833 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
834 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
835 </div>
836 <?php endif; ?>
837 <?php endif; ?>
838 </div>
839 </div>
840 </div>
841 <?php if ( 'yes' == $settings['show_image'] ) : ?>
842 <div class="upk-image-wrap">
843 <?php $this->render_image( get_post_thumbnail_id( $post_id ), $image_size ); ?>
844 </div>
845 <?php endif; ?>
846 </div>
847
848 <?php
849 }
850
851 protected function render() {
852 $settings = $this->get_settings_for_display();
853
854 $this->query_posts( $settings['item_limit']['size'] );
855 $wp_query = $this->get_query();
856
857 if ( ! $wp_query->found_posts ) {
858 return;
859 }
860 $this->add_render_attribute( 'list-wrap', 'class', 'upk-exotic-list upk-image-direction-' . $settings['image_direction_style']);
861
862 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
863 $this->add_render_attribute( 'list-wrap', 'class', 'upk-in-animation' );
864 if (isset($settings['upk_in_animation_delay']['size'])) {
865 $this->add_render_attribute( 'list-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size'] );
866 }
867 }
868
869 ?>
870 <div <?php $this->print_render_attribute_string('list-wrap'); ?>>
871
872 <?php while ( $wp_query->have_posts() ) :
873 $wp_query->the_post();
874
875 $thumbnail_size = $settings['primary_thumbnail_size'];
876
877 ?>
878
879 <?php $this->render_post_grid_item( get_the_ID(), $thumbnail_size ); ?>
880
881 <?php endwhile; ?>
882 </div>
883
884 <?php
885
886 if ( $settings['show_pagination'] ) { ?>
887 <div class="ep-pagination">
888 <?php ultimate_post_kit_post_pagination( $wp_query, $this->get_id() ); ?>
889 </div>
890 <?php
891 }
892 wp_reset_postdata();
893 }
894 }
895