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.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.0.9, at modules/exotic-list/widgets/exotic-list.php

880 lines 22.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\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' ) . BDTUPK_NC,
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', '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 ]
214 );
215
216 //Global Date Controls
217 $this->register_date_controls();
218
219 //Global Reading Time Controls
220 $this->register_reading_time_controls();
221
222 $this->add_control(
223 'show_pagination',
224 [
225 'label' => esc_html__( 'Show Pagination', 'ultimate-post-kit' ),
226 'type' => Controls_Manager::SWITCHER,
227 'separator' => 'before'
228 ]
229 );
230
231 $this->add_control(
232 'global_link',
233 [
234 'label' => __( 'Item Wrapper Link', 'ultimate-post-kit' ),
235 'type' => Controls_Manager::SWITCHER,
236 'prefix_class' => 'upk-global-link-',
237 'description' => __( 'Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit' ),
238 ]
239 );
240
241 $this->end_controls_section();
242
243 $this->start_controls_section(
244 'section_style_image',
245 [
246 'label' => esc_html__( 'Image', 'ultimate-post-kit' ),
247 'tab' => Controls_Manager::TAB_STYLE,
248 'condition' => [
249 'show_image' => 'yes'
250 ]
251 ]
252 );
253
254 $this->add_responsive_control(
255 'content_gap',
256 [
257 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
258 'type' => Controls_Manager::SLIDER,
259 'selectors' => [
260 '{{WRAPPER}} .upk-exotic-list .upk-content-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
261 ],
262 ]
263 );
264
265 $this->add_group_control(
266 Group_Control_Border::get_type(),
267 [
268 'name' => 'item_image_border',
269 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-image-wrap',
270 ]
271 );
272
273 $this->add_responsive_control(
274 'item_image_border_radius',
275 [
276 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
277 'type' => Controls_Manager::DIMENSIONS,
278 'size_units' => [ 'px', '%' ],
279 'selectors' => [
280 '{{WRAPPER}} .upk-exotic-list .upk-image-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
281 ],
282 ]
283 );
284
285 $this->add_responsive_control(
286 'item_image_height',
287 [
288 'label' => esc_html__( 'Height', 'ultimate-post-kit' ),
289 'type' => Controls_Manager::SLIDER,
290 'range' => [
291 'px' => [
292 'min' => 100,
293 'max' => 500,
294 ],
295 ],
296 'selectors' => [
297 '{{WRAPPER}} .upk-exotic-list' => 'height: {{SIZE}}{{UNIT}};',
298 ],
299 ]
300 );
301
302 $this->end_controls_section();
303
304 $this->start_controls_section(
305 'section_style_title',
306 [
307 'label' => esc_html__( 'Title', 'ultimate-post-kit' ),
308 'tab' => Controls_Manager::TAB_STYLE,
309 'condition' => [
310 'show_title' => 'yes',
311 ],
312 ]
313 );
314
315 $this->add_control(
316 'title_style',
317 [
318 'label' => esc_html__('Style', 'ultimate-post-kit'),
319 'type' => Controls_Manager::SELECT,
320 'default' => 'underline',
321 'options' => [
322 'underline' => esc_html__('Underline', 'ultimate-post-kit'),
323 'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'),
324 'overline' => esc_html__('Overline', 'ultimate-post-kit'),
325 'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'),
326 ],
327 ]
328 );
329
330 $this->add_control(
331 'title_color',
332 [
333 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
334 'type' => Controls_Manager::COLOR,
335 'selectors' => [
336 '{{WRAPPER}} .upk-exotic-list .upk-title a' => 'color: {{VALUE}};',
337 ],
338 ]
339 );
340
341 $this->add_control(
342 'title_hover_color',
343 [
344 'label' => esc_html__( 'Hover Color', 'ultimate-post-kit' ),
345 'type' => Controls_Manager::COLOR,
346 'selectors' => [
347 '{{WRAPPER}} .upk-exotic-list .upk-title a:hover' => 'color: {{VALUE}};',
348 ],
349 ]
350 );
351
352 $this->add_responsive_control(
353 'title_spacing',
354 [
355 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
356 'type' => Controls_Manager::SLIDER,
357 'range' => [
358 'px' => [
359 'min' => 0,
360 'max' => 50,
361 ],
362 ],
363 'selectors' => [
364 '{{WRAPPER}} .upk-exotic-list .upk-title' => 'padding-bottom: {{SIZE}}{{UNIT}};',
365 ],
366 ]
367 );
368
369 $this->add_group_control(
370 Group_Control_Typography::get_type(),
371 [
372 'name' => 'title_typography',
373 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
374 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-title',
375 ]
376 );
377
378 $this->add_group_control(
379 Group_Control_Text_Shadow::get_type(),
380 [
381 'name' => 'title_text_shadow',
382 'label' => __( 'Text Shadow', 'ultimate-post-kit' ),
383 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-title a',
384 ]
385 );
386
387 $this->end_controls_section();
388
389 $this->start_controls_section(
390 'section_style_date',
391 [
392 'label' => esc_html__( 'Date', 'ultimate-post-kit' ),
393 'tab' => Controls_Manager::TAB_STYLE,
394 'conditions' => [
395 'relation' => 'or',
396 'terms' => [
397 [
398 'name' => 'show_date',
399 'value' => 'yes'
400 ],
401 ]
402 ],
403 ]
404 );
405
406 $this->add_control(
407 'date_color',
408 [
409 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
410 'type' => Controls_Manager::COLOR,
411 'selectors' => [
412 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'color: {{VALUE}};',
413 ],
414 ]
415 );
416
417
418 $this->add_group_control(
419 Group_Control_Background::get_type(),
420 [
421 'name' => 'date_background',
422 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
423 ]
424 );
425
426 $this->add_group_control(
427 Group_Control_Border::get_type(),
428 [
429 'name' => 'date_border',
430 'label' => __( 'Border', 'ultimate-post-kit' ),
431 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
432 ]
433 );
434
435 $this->add_responsive_control(
436 'date_border_radius',
437 [
438 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
439 'type' => Controls_Manager::DIMENSIONS,
440 'size_units' => [ 'px', '%' ],
441 'selectors' => [
442 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
443 ],
444 ]
445 );
446
447 $this->add_responsive_control(
448 'date_padding',
449 [
450 'label' => esc_html__( 'Padding', 'ultimate-post-kit' ),
451 'type' => Controls_Manager::DIMENSIONS,
452 'size_units' => [ 'px', 'em', '%' ],
453 'selectors' => [
454 '{{WRAPPER}} .upk-exotic-list .upk-date-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
455 ],
456 ]
457 );
458
459
460 $this->add_responsive_control(
461 'date_spacing',
462 [
463 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
464 'type' => Controls_Manager::SLIDER,
465 'range' => [
466 'px' => [
467 'min' => 0,
468 'max' => 50,
469 'step' => 2,
470 ],
471 ],
472 'selectors' => [
473 '{{WRAPPER}} .upk-exotic-list .upk-content-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
474 ],
475 ]
476 );
477
478 $this->add_group_control(
479 Group_Control_Typography::get_type(),
480 [
481 'name' => 'date_typography',
482 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
483 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-date-wrap',
484 ]
485 );
486
487 $this->end_controls_section();
488
489
490 $this->start_controls_section(
491 'section_style_author',
492 [
493 'label' => esc_html__( 'Author', 'ultimate-post-kit' ),
494 'tab' => Controls_Manager::TAB_STYLE,
495 'conditions' => [
496 'relation' => 'or',
497 'terms' => [
498 [
499 'name' => 'show_author',
500 'value' => 'yes'
501 ],
502 ]
503 ],
504 ]
505 );
506
507 $this->add_control(
508 'author_color',
509 [
510 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
511 'type' => Controls_Manager::COLOR,
512 'selectors' => [
513 '{{WRAPPER}} .upk-exotic-list .upk-author a' => 'color: {{VALUE}};',
514 ],
515 ]
516 );
517
518 $this->add_control(
519 'author_hover_color',
520 [
521 'label' => esc_html__( 'Hover Color', 'ultimate-post-kit' ),
522 'type' => Controls_Manager::COLOR,
523 'selectors' => [
524 '{{WRAPPER}} .upk-exotic-list .upk-author a:hover' => 'color: {{VALUE}};',
525 ],
526 ]
527 );
528
529 // $this->add_responsive_control(
530 // 'author_spacing',
531 // [
532 // 'label' => esc_html__( 'Spacing', 'ultimate-post-kit' ),
533 // 'type' => Controls_Manager::SLIDER,
534 // 'range' => [
535 // 'px' => [
536 // 'min' => 0,
537 // 'max' => 50,
538 // 'step' => 2,
539 // ],
540 // ],
541 // 'selectors' => [
542 // '{{WRAPPER}} .upk-exotic-list .upk-meta' => 'grid-column-gap: {{SIZE}}{{UNIT}};',
543 // ],
544 // ]
545 // );
546 $this->add_responsive_control(
547 'author_spacing',
548 [
549 'label' => esc_html__('Space Between', 'ultimate-post-kit'),
550 'type' => Controls_Manager::SLIDER,
551 'range' => [
552 'px' => [
553 'min' => 0,
554 'max' => 50,
555 ],
556 ],
557 'selectors' => [
558 '{{WRAPPER}} .upk-exotic-list .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};',
559 ],
560 ]
561 );
562
563 $this->add_group_control(
564 Group_Control_Typography::get_type(),
565 [
566 'name' => 'author_typography',
567 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
568 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-author',
569 ]
570 );
571
572 $this->end_controls_section();
573
574 $this->start_controls_section(
575 'section_style_category',
576 [
577 'label' => esc_html__( 'Category', 'ultimate-post-kit' ),
578 'tab' => Controls_Manager::TAB_STYLE,
579 'condition' => [
580 'show_category' => 'yes',
581 ],
582 ]
583 );
584
585 $this->start_controls_tabs( 'tabs_category_style' );
586
587 $this->start_controls_tab(
588 'tab_category_normal',
589 [
590 'label' => esc_html__( 'Normal', 'ultimate-post-kit' ),
591 ]
592 );
593
594 $this->add_control(
595 'category_color',
596 [
597 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
598 'type' => Controls_Manager::COLOR,
599 'selectors' => [
600 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'color: {{VALUE}};',
601 ],
602 ]
603 );
604
605 $this->add_group_control(
606 Group_Control_Background::get_type(),
607 [
608 'name' => 'category_background',
609 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
610 ]
611 );
612
613 $this->add_group_control(
614 Group_Control_Border::get_type(),
615 [
616 'name' => 'category_border',
617 'label' => __( 'Border', 'ultimate-post-kit' ),
618 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
619 ]
620 );
621
622 $this->add_responsive_control(
623 'category_border_radius',
624 [
625 'label' => esc_html__( 'Border Radius', 'ultimate-post-kit' ),
626 'type' => Controls_Manager::DIMENSIONS,
627 'size_units' => [ 'px', '%' ],
628 'selectors' => [
629 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
630 ],
631 ]
632 );
633
634 $this->add_responsive_control(
635 'category_padding',
636 [
637 'label' => esc_html__( 'Padding', 'ultimate-post-kit' ),
638 'type' => Controls_Manager::DIMENSIONS,
639 'size_units' => [ 'px', 'em', '%' ],
640 'selectors' => [
641 '{{WRAPPER}} .upk-exotic-list .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
642 ],
643 ]
644 );
645
646 $this->add_responsive_control(
647 'category_spacing',
648 [
649 'label' => esc_html__( 'Space Between', 'ultimate-post-kit' ),
650 'type' => Controls_Manager::SLIDER,
651 'range' => [
652 'px' => [
653 'min' => 0,
654 'max' => 50,
655 'step' => 2,
656 ],
657 ],
658 'selectors' => [
659 '{{WRAPPER}} .upk-exotic-list .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};',
660 ],
661 ]
662 );
663
664
665 $this->add_group_control(
666 Group_Control_Box_Shadow::get_type(),
667 [
668 'name' => 'category_shadow',
669 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
670 ]
671 );
672
673 $this->add_group_control(
674 Group_Control_Typography::get_type(),
675 [
676 'name' => 'category_typography',
677 'label' => esc_html__( 'Typography', 'ultimate-post-kit' ),
678 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a',
679 ]
680 );
681
682 $this->end_controls_tab();
683
684 $this->start_controls_tab(
685 'tab_category_hover',
686 [
687 'label' => esc_html__( 'Hover', 'ultimate-post-kit' ),
688 ]
689 );
690
691 $this->add_control(
692 'category_hover_color',
693 [
694 'label' => esc_html__( 'Color', 'ultimate-post-kit' ),
695 'type' => Controls_Manager::COLOR,
696 'selectors' => [
697 '{{WRAPPER}} .upk-exotic-list .upk-category a:hover' => 'color: {{VALUE}};',
698 ],
699 ]
700 );
701
702 $this->add_group_control(
703 Group_Control_Background::get_type(),
704 [
705 'name' => 'category_hover_background',
706 'selector' => '{{WRAPPER}} .upk-exotic-list .upk-category a:hover',
707 ]
708 );
709
710 $this->add_control(
711 'category_hover_border_color',
712 [
713 'label' => esc_html__( 'Border Color', 'ultimate-post-kit' ),
714 'type' => Controls_Manager::COLOR,
715 'condition' => [
716 'category_border_border!' => '',
717 ],
718 'selectors' => [
719 '{{WRAPPER}} .upk-exotic-list .upk-category a:hover' => 'border-color: {{VALUE}};',
720 ],
721 ]
722 );
723
724 $this->end_controls_tab();
725
726 $this->end_controls_tabs();
727
728 $this->end_controls_section();
729
730 //Global Pagination Controls
731 $this->register_pagination_controls();
732 }
733
734 /**
735 * Main query render for this widget
736 * @param $posts_per_page number item query limit
737 */
738 public function query_posts( $posts_per_page ) {
739
740 $default = $this->getGroupControlQueryArgs();
741 if ( $posts_per_page ) {
742 $args['posts_per_page'] = $posts_per_page;
743 $args['paged'] = max( 1, get_query_var( 'paged' ), get_query_var( 'page' ) );
744 }
745 $args = array_merge( $default, $args );
746 $this->_query = new WP_Query( $args );
747 }
748
749 public function render_author() {
750
751 if ( ! $this->get_settings( 'show_author' ) ) {
752 return;
753 }
754
755 ?>
756 <div class="upk-author">
757 <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) ?>">
758 <?php echo esc_html( get_the_author() ) ?>
759 </a>
760 </div>
761
762 <?php
763 }
764
765 public function render_date() {
766 $settings = $this->get_settings_for_display();
767
768 if ( ! $this->get_settings( 'show_date' ) ) {
769 return;
770 }
771
772 ?>
773 <div class="upk-date-wrap">
774 <span>
775 <?php if ($settings['human_diff_time'] == 'yes') {
776 echo esc_html( ultimate_post_kit_post_time_diff( ( $settings['human_diff_time_short'] == 'yes' ) ? 'short' : '' ) );
777 } else {
778 echo get_the_date();
779 } ?>
780 </span>
781 </div>
782 <?php if ($settings['show_time']) : ?>
783 <div class="upk-post-time">
784 <i class="upk-icon-clock" aria-hidden="true"></i>
785 <?php echo esc_html( get_the_time() ); ?>
786 </div>
787 <?php endif; ?>
788
789 <?php
790 }
791
792 public function render_post_grid_item( $post_id, $image_size ) {
793 $settings = $this->get_settings_for_display();
794
795 if ( 'yes' == $settings['global_link'] ) {
796
797 $this->add_render_attribute( 'list-item', 'onclick', "window.open('" . esc_url( get_permalink() ) . "', '_self')", true );
798 }
799 $this->add_render_attribute( 'list-item', 'class', 'upk-item', true );
800
801 ?>
802 <div <?php $this->print_render_attribute_string( 'list-item' ); ?>>
803
804 <div class="upk-content-wrap">
805 <?php $this->render_date(); ?>
806 <div class="upk-inner-content">
807 <?php $this->render_title(substr($this->get_name(), 4)); ?>
808 <div class="upk-meta">
809 <?php $this->render_category(); ?>
810
811 <?php if ($settings['show_author']) : ?>
812 <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
813 <?php $this->render_author(); ?>
814 </div>
815 <?php endif; ?>
816 <?php if (_is_upk_pro_activated()) :
817 if ('yes' === $settings['show_reading_time']) : ?>
818 <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
819 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
820 </div>
821 <?php endif; ?>
822 <?php endif; ?>
823 </div>
824 </div>
825 </div>
826 <?php if ( 'yes' == $settings['show_image'] ) : ?>
827 <div class="upk-image-wrap">
828 <?php $this->render_image( get_post_thumbnail_id( $post_id ), $image_size ); ?>
829 </div>
830 <?php endif; ?>
831 </div>
832
833 <?php
834 }
835
836 protected function render() {
837 $settings = $this->get_settings_for_display();
838
839 $this->query_posts( $settings['item_limit']['size'] );
840 $wp_query = $this->get_query();
841
842 if ( ! $wp_query->found_posts ) {
843 return;
844 }
845 $this->add_render_attribute( 'list-wrap', 'class', 'upk-exotic-list upk-image-direction-' . $settings['image_direction_style']);
846
847 if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) {
848 $this->add_render_attribute( 'list-wrap', 'class', 'upk-in-animation' );
849 if (isset($settings['upk_in_animation_delay']['size'])) {
850 $this->add_render_attribute( 'list-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size'] );
851 }
852 }
853
854 ?>
855 <div <?php $this->print_render_attribute_string('list-wrap'); ?>>
856
857 <?php while ( $wp_query->have_posts() ) :
858 $wp_query->the_post();
859
860 $thumbnail_size = $settings['primary_thumbnail_size'];
861
862 ?>
863
864 <?php $this->render_post_grid_item( get_the_ID(), $thumbnail_size ); ?>
865
866 <?php endwhile; ?>
867 </div>
868
869 <?php
870
871 if ( $settings['show_pagination'] ) { ?>
872 <div class="ep-pagination">
873 <?php ultimate_post_kit_post_pagination( $wp_query, $this->get_id() ); ?>
874 </div>
875 <?php
876 }
877 wp_reset_postdata();
878 }
879 }
880