PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.4.6
Easy Elements for Elementor – Addons & Website Templates v1.4.6
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / widgets / archive-post / archive-post.php

archive-post.php in Easy Elements for Elementor – Addons & Website Templates 1.4.6, at widgets/archive-post/archive-post.php

2,209 lines 82.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Easyel\EasyElements\Widgets;
3 use Elementor\Utils;
4 use Elementor\Icons_Manager;
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Image_Size;
7
8 defined( 'ABSPATH' ) || die();
9
10 class Easyel_Free_Archive_Post__Widget extends \Elementor\Widget_Base {
11 protected function get_all_posts() {
12 $posts = get_posts( [ 'numberposts' => -1 ] );
13 $options = [];
14 foreach ( $posts as $post ) {
15 $options[ $post->ID ] = $post->post_title;
16 }
17 return $options;
18 }
19
20 protected function get_post_type_options() {
21 $exclude_post_types = ['attachment', 'revision', 'nav_menu_item'];
22
23 $post_types = get_post_types(['public' => true], 'objects');
24 $options = [];
25
26 foreach ($post_types as $post_type => $post_type_obj) {
27 if (!in_array($post_type, $exclude_post_types)) {
28 $taxonomies = get_object_taxonomies($post_type, 'names');
29 if (!empty($taxonomies)) {
30 $options[$post_type] = $post_type_obj->label;
31 }
32 }
33 }
34
35 return $options;
36 }
37
38
39 protected function get_all_categories() {
40 $cats = get_categories( [ 'hide_empty' => false ] );
41 $options = [];
42 foreach ( $cats as $cat ) {
43 $options[ $cat->term_id ] = $cat->name;
44 }
45 return $options;
46 }
47
48
49 public function get_name() {
50 return 'eel-archive-post';
51 }
52
53 public function get_title() {
54 return esc_html__( 'Archive posts', 'easy-elements' );
55 }
56
57 public function get_icon() {
58 return 'easyicon easyelIcon-post-grid';
59 }
60
61 public function get_categories() {
62 return [ 'easyelements_category' ];
63 }
64
65 public function get_keywords() {
66 return [ 'blog', 'grid', 'post', 'news' ];
67 }
68
69 public function get_style_depends() {
70 return [
71 'eel-archive-post',
72 ];
73 }
74
75 protected function register_controls() {
76 $this->start_controls_section(
77 '_section_grid',
78 [
79 'label' => esc_html__( 'Posts Settings', 'easy-elements' ),
80 'tab' => Controls_Manager::TAB_CONTENT,
81 ]
82 );
83
84 $this->add_control(
85 'title_trim',
86 [
87 'label' => esc_html__( 'Title Trim Words', 'easy-elements' ),
88 'type' => Controls_Manager::NUMBER,
89 'default' => 10,
90 'min' => 1,
91 'max' => 100,
92 'description' => esc_html__('Limit number of words in the post title', 'easy-elements'),
93 ]
94 );
95
96
97 $this->add_control(
98 'show_excerpt',
99 [
100 'label' => esc_html__( 'Show Excerpt', 'easy-elements' ),
101 'type' => Controls_Manager::SWITCHER,
102 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
103 'label_off' => esc_html__( 'No', 'easy-elements' ),
104 'default' => 'yes',
105 ]
106 );
107
108 $this->add_control(
109 'excerpt_trim',
110 [
111 'label' => esc_html__( 'Excerpt Trim Words', 'easy-elements' ),
112 'type' => Controls_Manager::NUMBER,
113 'default' => 20,
114 'min' => 5,
115 'max' => 200,
116 'description' => esc_html__('Limit number of words in the excerpt', 'easy-elements'),
117 'condition' => [
118 'show_excerpt' => 'yes',
119 ]
120 ]
121 );
122
123 $this->add_control(
124 'title_tag',
125 [
126 'label' => esc_html__( 'Title HTML Tag', 'easy-elements' ),
127 'type' => Controls_Manager::SELECT,
128 'options' => [
129 'h1' => 'H1',
130 'h2' => 'H2',
131 'h3' => 'H3',
132 'h4' => 'H4',
133 'h5' => 'H5',
134 'h6' => 'H6',
135 ],
136 'default' => 'h3',
137 ]
138 );
139
140 $this->add_control(
141 'show_thumbnail',
142 [
143 'label' => esc_html__( 'Show Thumbnail', 'easy-elements' ),
144 'type' => Controls_Manager::SWITCHER,
145 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
146 'label_off' => esc_html__( 'No', 'easy-elements' ),
147 'default' => 'yes',
148 ]
149 );
150
151
152 $this->add_group_control(
153 Group_Control_Image_Size::get_type(),
154 [
155 'name' => 'thumbnail',
156 // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude
157 'exclude' => ['custom'],
158 'default' => 'medium',
159 ]
160 );
161
162 $this->add_responsive_control(
163 'image_border_radius',
164 [
165 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
166 'type' => \Elementor\Controls_Manager::DIMENSIONS,
167 'size_units' => [ 'px', '%' ],
168 'selectors' => [
169 '{{WRAPPER}} .eel-post-grid-wrap .grid-item img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
170 ],
171 ]
172 );
173
174 $this->add_responsive_control(
175 'post_image_height',
176 [
177 'label' => esc_html__( 'Image Height', 'easy-elements' ),
178 'type' => \Elementor\Controls_Manager::SLIDER,
179 'size_units' => [ 'px', 'em', '%' ],
180 'range' => [
181 'px' => [
182 'min' => 0,
183 'max' => 1000,
184 ],
185 'em' => [
186 'min' => 0,
187 'max' => 50,
188 ],
189 '%' => [
190 'min' => 0,
191 'max' => 100,
192 ],
193 ],
194 'selectors' => [
195 '{{WRAPPER}} .eel-post-grid-wrap .grid-item img' => 'height: {{SIZE}}{{UNIT}};',
196 ],
197 ]
198 );
199
200 $this->add_control(
201 'item_alignment',
202 [
203 'label' => __( 'Alignment', 'easy-elements' ),
204 'type' => \Elementor\Controls_Manager::CHOOSE,
205 'options' => [
206 'left' => [
207 'title' => __( 'Left', 'easy-elements' ),
208 'icon' => 'eicon-text-align-left',
209 ],
210 'center' => [
211 'title' => __( 'Center', 'easy-elements' ),
212 'icon' => 'eicon-text-align-center',
213 ],
214 'right' => [
215 'title' => __( 'Right', 'easy-elements' ),
216 'icon' => 'eicon-text-align-right',
217 ],
218 ],
219 'default' => 'left',
220 'toggle' => true,
221 'selectors' => [
222 '{{WRAPPER}} .eel-post-grid-wrap .grid-item' => 'text-align: {{VALUE}};',
223 ],
224 ]
225 );
226
227 $this->add_responsive_control(
228 'columns',
229 [
230 'label' => esc_html__( 'Select Columns', 'easy-elements' ),
231 'type' => Controls_Manager::SELECT,
232 'default' => '4',
233 'tablet_default' => '3',
234 'mobile_default' => '2',
235 'options' => [
236 '1' => '1 Column',
237 '2' => '2 Columns',
238 '3' => '3 Columns',
239 '4' => '4 Columns',
240 '5' => '5 Columns',
241 '6' => '6 Columns',
242 ],
243 'selectors' => [
244 '{{WRAPPER}} .eel-post-grid-wrap' =>
245 'grid-template-columns: repeat({{VALUE}}, 1fr);',
246 ],
247 ]
248 );
249
250 $this->add_responsive_control(
251 'ar_flex_gap',
252 [
253 'label' => esc_html__( 'Column Spacing', 'easy-elements' ),
254 'type' => \Elementor\Controls_Manager::SLIDER,
255 'size_units' => [ 'px', 'em', 'rem' ],
256 'range' => [
257 'px' => [
258 'min' => 0,
259 'max' => 100,
260 ],
261 'em' => [
262 'min' => 0,
263 'max' => 10,
264 ],
265 'rem' => [
266 'min' => 0,
267 'max' => 10,
268 ],
269 ],
270 'default' => [
271 'unit' => 'px',
272 'size' => 30,
273 ],
274 'selectors' => [
275 '{{WRAPPER}} .eel-post-grid-wrap' => 'gap: {{SIZE}}{{UNIT}};',
276 ],
277 ]
278 );
279
280 $this->end_controls_section();
281
282 $this->start_controls_section(
283 '_section_grid_query',
284 [
285 'label' => esc_html__( 'Query Settings', 'easy-elements' ),
286 'tab' => Controls_Manager::TAB_CONTENT,
287 ]
288 );
289
290 $is_pro = apply_filters( 'easyel/pro_enabled', false );
291
292 $post_type_options = [ 'post' => esc_html__( 'Post', 'easy-elements' ) ];
293 if ( $is_pro ) {
294 $post_type_options = $this->get_post_type_options();
295 }
296
297 $this->add_control(
298 'post_type',
299 [
300 'label' => esc_html__( 'Post Type', 'easy-elements' ),
301 'type' => Controls_Manager::SELECT,
302 'options' => $post_type_options,
303 'default' => 'post',
304 ]
305 );
306
307 $options = [
308 'category' => esc_html__( 'Category', 'easy-elements' ),
309 'post' => esc_html__( 'Specific Posts', 'easy-elements' ),
310 ];
311
312 if ( $is_pro ) {
313 $options['user'] = esc_html__( 'User', 'easy-elements' );
314 $options['userrole'] = esc_html__( 'UserRole', 'easy-elements' );
315 }
316
317 $this->add_control(
318 'source_type',
319 [
320 'label' => esc_html__( 'Source Type', 'easy-elements' ),
321 'type' => Controls_Manager::SELECT,
322 'options' => $options,
323 'default' => 'category',
324 ]
325 );
326
327
328 $this->add_control(
329 'categories',
330 [
331 'label' => esc_html__( 'Select Categories', 'easy-elements' ),
332 'type' => Controls_Manager::SELECT2,
333 'multiple' => true,
334 'options' => $this->get_all_categories(),
335 'label_block' => true,
336 'condition' => [
337 'source_type' => 'category',
338 ],
339 ]
340 );
341
342 $this->add_control(
343 'post__in',
344 [
345 'label' => esc_html__( 'Select Specific Posts', 'easy-elements' ),
346 'type' => Controls_Manager::SELECT2,
347 'options' => $this->get_all_posts(),
348 'multiple' => true,
349 'label_block' => true,
350 'condition' => [
351 'source_type' => 'post',
352 ],
353 ]
354 );
355
356 $this->add_control(
357 'exclude_posts',
358 [
359 'label' => esc_html__( 'Exclude Posts', 'easy-elements' ),
360 'type' => \Elementor\Controls_Manager::SELECT2,
361 'multiple' => true,
362 'options' => $this->get_all_posts(),
363 'label_block' => true,
364 'condition' => [
365 'source_type!' => 'post',
366 ],
367 ]
368 );
369
370 $this->add_control(
371 'exclude_categories',
372 [
373 'label' => esc_html__( 'Exclude Categories', 'easy-elements' ),
374 'type' => Controls_Manager::SELECT2,
375 'multiple' => true,
376 'options' => $this->get_all_categories(),
377 'label_block' => true,
378 'condition' => [
379 'source_type' => 'category',
380 ],
381 ]
382 );
383
384 if ( apply_filters( 'easyel/pro_enabled', false ) ) {
385
386 do_action( 'easyel/userdata/source/control', $this );
387 }
388
389 $this->add_control(
390 'offset',
391 [
392 'label' => esc_html__( 'Offset', 'easy-elements' ),
393 'type' => Controls_Manager::NUMBER,
394 'min' => 0,
395 'max' => 100,
396 'description' => esc_html__( 'Skip posts from the top of the query.', 'easy-elements' ),
397 ]
398 );
399
400 $this->add_control(
401 'orderby',
402 [
403 'label' => esc_html__( 'Order By', 'easy-elements' ),
404 'type' => Controls_Manager::SELECT,
405 'options' => [
406 'date' => esc_html__( 'Date', 'easy-elements' ),
407 'title' => esc_html__( 'Title', 'easy-elements' ),
408 'rand' => esc_html__( 'Random', 'easy-elements' ),
409 'menu_order' => esc_html__( 'Menu Order', 'easy-elements' ),
410 ],
411 'default' => 'date',
412 ]
413 );
414
415 $this->add_control(
416 'order',
417 [
418 'label' => esc_html__( 'Order', 'easy-elements' ),
419 'type' => Controls_Manager::SELECT,
420 'options' => [
421 'DESC' => esc_html__( 'Descending', 'easy-elements' ),
422 'ASC' => esc_html__( 'Ascending', 'easy-elements' ),
423 ],
424 'default' => 'DESC',
425 ]
426 );
427
428
429 $this->end_controls_section();
430
431
432 $this->start_controls_section(
433 '_section_meta',
434 [
435 'label' => esc_html__( 'Meta Settings', 'easy-elements' ),
436 'tab' => Controls_Manager::TAB_CONTENT,
437 ]
438 );
439
440 $this->add_control(
441 'show_meta',
442 [
443 'label' => esc_html__('Show Meta', 'easy-elements'),
444 'type' => \Elementor\Controls_Manager::SELECT2,
445 'multiple' => true,
446 'options' => [
447 'date' => esc_html__('Date', 'easy-elements'),
448 'author' => esc_html__('Author', 'easy-elements'),
449 'category' => esc_html__('Category', 'easy-elements'),
450 'comments' => esc_html__('Comments', 'easy-elements'),
451 'read_time' => esc_html__('Reading Time', 'easy-elements'),
452 ],
453 'default' => ['date', 'author'],
454 'label_block' => true,
455 ]
456 );
457
458 $this->add_control(
459 'meta_order_heading',
460 [
461 'label' => esc_html__('Meta Order (1 = First)', 'easy-elements'),
462 'type' => \Elementor\Controls_Manager::HEADING,
463 'separator' => 'before',
464 ]
465 );
466
467 $this->add_control(
468 'meta_order_date',
469 [
470 'label' => esc_html__('Date', 'easy-elements'),
471 'type' => \Elementor\Controls_Manager::NUMBER,
472 'default' => 1,
473 'min' => 1,
474 'max' => 5,
475 'condition' => [ 'show_meta' => 'date' ],
476 ]
477 );
478
479 $this->add_control(
480 'meta_order_author',
481 [
482 'label' => esc_html__('Author', 'easy-elements'),
483 'type' => \Elementor\Controls_Manager::NUMBER,
484 'default' => 2,
485 'min' => 1,
486 'max' => 5,
487 'condition' => [ 'show_meta' => 'author' ],
488 ]
489 );
490
491 $this->add_control(
492 'meta_order_category',
493 [
494 'label' => esc_html__('Category', 'easy-elements'),
495 'type' => \Elementor\Controls_Manager::NUMBER,
496 'default' => 3,
497 'min' => 1,
498 'max' => 5,
499 'condition' => [ 'show_meta' => 'category' ],
500 ]
501 );
502
503 $this->add_control(
504 'meta_order_comments',
505 [
506 'label' => esc_html__('Comments', 'easy-elements'),
507 'type' => \Elementor\Controls_Manager::NUMBER,
508 'default' => 4,
509 'min' => 1,
510 'max' => 5,
511 'condition' => [ 'show_meta' => 'comments' ],
512 ]
513 );
514
515 $this->add_control(
516 'meta_order_read_time',
517 [
518 'label' => esc_html__('Reading Time', 'easy-elements'),
519 'type' => \Elementor\Controls_Manager::NUMBER,
520 'default' => 5,
521 'min' => 1,
522 'max' => 5,
523 'condition' => [ 'show_meta' => 'read_time' ],
524 ]
525 );
526
527 $this->add_control(
528 'show_date_icon',
529 [
530 'label' => esc_html__( 'Show Date Icon', 'easy-elements' ),
531 'type' => Controls_Manager::SWITCHER,
532 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
533 'label_off' => esc_html__( 'No', 'easy-elements' ),
534 'default' => 'yes',
535 'condition' => [
536 'show_meta' => 'date',
537 ]
538 ]
539 );
540
541 $this->add_control(
542 'date_icon',
543 [
544 'label' => esc_html__( 'Date Icon', 'easy-elements' ),
545 'type' => \Elementor\Controls_Manager::ICONS,
546 'default' => [
547 'value' => '',
548 'library' => 'fa-solid',
549 ],
550 'condition' => [
551 'show_date_icon' => 'yes',
552 'show_meta' => 'date',
553 ],
554 ]
555 );
556
557 $this->add_control(
558 'show_by_label',
559 [
560 'label' => __( 'Show "By" Label', 'easy-elements' ),
561 'type' => \Elementor\Controls_Manager::SWITCHER,
562 'label_on' => __( 'Yes', 'easy-elements' ),
563 'label_off' => __( 'No', 'easy-elements' ),
564 'return_value' => 'yes',
565 'default' => 'yes',
566 ]
567 );
568
569 $this->add_control(
570 'author_link_enable',
571 [
572 'label' => __( 'Author Link', 'easy-elements' ),
573 'type' => \Elementor\Controls_Manager::SWITCHER,
574 'label_on' => __( 'Yes', 'easy-elements' ),
575 'label_off' => __( 'No', 'easy-elements' ),
576 'return_value' => 'yes',
577 'default' => '',
578 ]
579 );
580
581
582 $this->add_control(
583 'author_icon_type',
584 [
585 'label' => esc_html__( 'Author Indicator', 'easy-elements' ),
586 'type' => Controls_Manager::SELECT,
587 'default' => 'icon',
588 'options' => [
589 'none' => esc_html__( 'None', 'easy-elements' ),
590 'icon' => esc_html__( 'Icon', 'easy-elements' ),
591 'avatar' => esc_html__( 'Avatar', 'easy-elements' ),
592 ],
593 'condition' => [
594 'show_meta' => 'author',
595 ],
596 ]
597 );
598
599 $this->add_control(
600 'author_icon',
601 [
602 'label' => esc_html__( 'Author Icon', 'easy-elements' ),
603 'type' => \Elementor\Controls_Manager::ICONS,
604 'default' => [
605 'value' => '',
606 'library' => 'fa-solid',
607 ],
608 'condition' => [
609 'author_icon_type' => 'icon',
610 'show_meta' => 'author',
611 ],
612 ]
613 );
614
615 $this->add_responsive_control(
616 'author_avatar_size',
617 [
618 'label' => esc_html__( 'Avatar Size', 'easy-elements' ),
619 'type' => Controls_Manager::SLIDER,
620 'range' => [
621 'px' => [ 'min' => 16, 'max' => 100 ],
622 ],
623 'default' => [ 'size' => 22, 'unit' => 'px' ],
624 'selectors' => [
625 '{{WRAPPER}} .eel--blog-author.eel--has-avatar .eel--author-avatar' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
626 ],
627 'condition' => [
628 'author_icon_type' => 'avatar',
629 'show_meta' => 'author',
630 ],
631 ]
632 );
633
634 $this->add_responsive_control(
635 'author_avatar_border_radius',
636 [
637 'label' => esc_html__( 'Avatar Border Radius', 'easy-elements' ),
638 'type' => Controls_Manager::SLIDER,
639 'range' => [
640 'px' => [ 'min' => 0, 'max' => 100 ],
641 '%' => [ 'min' => 0, 'max' => 100 ],
642 ],
643 'size_units' => [ 'px', '%' ],
644 'default' => [ 'size' => 50, 'unit' => '%' ],
645 'selectors' => [
646 '{{WRAPPER}} .eel--blog-author.eel--has-avatar .eel--author-avatar' => 'border-radius: {{SIZE}}{{UNIT}};',
647 ],
648 'condition' => [
649 'author_icon_type' => 'avatar',
650 'show_meta' => 'author',
651 ],
652 ]
653 );
654
655
656 $this->add_control(
657 'show_category_icon',
658 [
659 'label' => esc_html__( 'Show Category Icon', 'easy-elements' ),
660 'type' => Controls_Manager::SWITCHER,
661 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
662 'label_off' => esc_html__( 'No', 'easy-elements' ),
663 'default' => 'yes',
664 'condition' => [
665 'show_meta' => 'category',
666 ]
667 ]
668 );
669
670 $this->add_control(
671 'category_icon',
672 [
673 'label' => esc_html__( 'Category Icon', 'easy-elements' ),
674 'type' => \Elementor\Controls_Manager::ICONS,
675 'default' => [
676 'value' => '',
677 'library' => 'fa-solid',
678 ],
679 'condition' => [
680 'show_category_icon' => 'yes',
681 'show_meta' => 'category',
682 ],
683 ]
684 );
685
686 $this->add_control(
687 'show_comments_icon',
688 [
689 'label' => esc_html__( 'Show Comments Icon', 'easy-elements' ),
690 'type' => \Elementor\Controls_Manager::SWITCHER,
691 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
692 'label_off' => esc_html__( 'No', 'easy-elements' ),
693 'default' => 'yes',
694 'condition' => [
695 'show_meta' => 'comments',
696 ]
697 ]
698 );
699
700 $this->add_control(
701 'comments_icon',
702 [
703 'label' => esc_html__( 'Comments Icon', 'easy-elements' ),
704 'type' => \Elementor\Controls_Manager::ICONS,
705 'condition' => [
706 'show_comments_icon' => 'yes',
707 'show_meta' => 'comments',
708 ],
709 ]
710 );
711
712 $this->add_control(
713 'show_read_time_icon',
714 [
715 'label' => esc_html__('Show Reading Time Icon', 'easy-elements'),
716 'type' => \Elementor\Controls_Manager::SWITCHER,
717 'default' => 'yes',
718 ]
719 );
720
721 $this->add_control(
722 'read_time_icon',
723 [
724 'label' => esc_html__('Reading Time Icon', 'easy-elements'),
725 'type' => \Elementor\Controls_Manager::ICONS,
726 'condition' => [
727 'show_read_time_icon' => 'yes',
728 ],
729 ]
730 );
731
732 $this->add_control(
733 'show_date_on_top',[
734 'label' => esc_html__( 'Date Badge', 'easy-elements' ),
735 'type' => \Elementor\Controls_Manager::SWITCHER,
736 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
737 'label_off' => esc_html__( 'No', 'easy-elements' ),
738 'default' => 'no',
739 ]
740 );
741
742 $this->add_control(
743 'show_category_badge',[
744 'label' => esc_html__( 'Category Badge', 'easy-elements' ),
745 'type' => \Elementor\Controls_Manager::SWITCHER,
746 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
747 'label_off' => esc_html__( 'No', 'easy-elements' ),
748 'default' => 'no',
749 ]
750 );
751
752 $this->add_responsive_control(
753 'meta_icon_offset',
754 [
755 'label' => esc_html__( 'Meta Icon Offset (px)', 'easy-elements' ),
756 'type' => \Elementor\Controls_Manager::SLIDER,
757 'size_units' => [ 'px' ],
758 'range' => [
759 'px' => [
760 'min' => -50,
761 'max' => 100,
762 ],
763 ],
764 'selectors' => [
765 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta svg, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta i' => 'top: {{SIZE}}{{UNIT}};',
766 ],
767 ]
768 );
769
770 $this->add_control(
771 'meta_position',
772 [
773 'label' => esc_html__( 'Meta Position', 'easy-elements' ),
774 'type' => \Elementor\Controls_Manager::CHOOSE,
775 'default' => 'up_title',
776 'options' => [
777 'up_title' => [
778 'title' => esc_html__( 'Above Title', 'easy-elements' ),
779 'icon' => 'eicon-v-align-top',
780 ],
781 'below_title' => [
782 'title' => esc_html__( 'Below Title', 'easy-elements' ),
783 'icon' => 'eicon-v-align-middle',
784 ],
785 'below_content' => [
786 'title' => esc_html__( 'Below Content', 'easy-elements' ),
787 'icon' => 'eicon-v-align-bottom',
788 ],
789 ],
790 'toggle' => false,
791 ]
792 );
793
794
795 $this->add_control(
796 'eel_separator',
797 [
798 'label' => esc_html__( 'Separator Type', 'easy-elements' ),
799 'type' => \Elementor\Controls_Manager::SELECT,
800 'options' => [
801 '' => esc_html__( 'None', 'easy-elements' ),
802 'line' => esc_html__( 'Line', 'easy-elements' ),
803 'circle' => esc_html__( 'Circle', 'easy-elements' ),
804 ],
805 'default' => '',
806 ]
807 );
808
809 $this->add_control(
810 'separator_color',
811 [
812 'label' => __( 'Separator Color', 'easy-elements' ),
813 'type' => \Elementor\Controls_Manager::COLOR,
814 'selectors' => [
815 '{{WRAPPER}} .eel--separator--line li + li::before, {{WRAPPER}} .eel--separator--circle li + li::before' => 'background-color: {{VALUE}};',
816 ],
817 'condition' => [
818 'eel_separator!' => '',
819 ],
820 ]
821 );
822
823 $this->add_responsive_control(
824 'separator_offset',
825 [
826 'label' => esc_html__( 'Separator Offset (px)', 'easy-elements' ),
827 'type' => \Elementor\Controls_Manager::SLIDER,
828 'size_units' => [ 'px' ],
829 'range' => [
830 'px' => [
831 'min' => -50,
832 'max' => 100,
833 ],
834 ],
835 'selectors' => [
836 '{{WRAPPER}} .eel--separator--line li + li::before, {{WRAPPER}} .eel--separator--circle li + li::before' => 'top: {{SIZE}}{{UNIT}};',
837 ],
838 'condition' => [
839 'eel_separator!' => '',
840 ],
841 ]
842 );
843
844
845 $this->add_responsive_control(
846 'meta_margin',
847 [
848 'label' => __( 'Margin', 'easy-elements' ),
849 'type' => \Elementor\Controls_Manager::DIMENSIONS,
850 'size_units' => [ 'px', 'em', '%' ],
851 'selectors' => [
852 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
853 ],
854 ]
855 );
856
857 $this->end_controls_section();
858
859 $this->start_controls_section(
860 '_section_button',
861 [
862 'label' => esc_html__( 'Button Settings', 'easy-elements' ),
863 'tab' => Controls_Manager::TAB_CONTENT,
864 ]
865 );
866
867 $this->add_control(
868 'show_read_more',
869 [
870 'label' => esc_html__( 'Show Read More', 'easy-elements' ),
871 'type' => \Elementor\Controls_Manager::SWITCHER,
872 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
873 'label_off' => esc_html__( 'No', 'easy-elements' ),
874 'return_value' => 'yes',
875 'default' => 'yes',
876 ]
877 );
878
879 $this->add_control(
880 'read_more_text',
881 [
882 'label' => esc_html__( 'Read More', 'easy-elements' ),
883 'type' => \Elementor\Controls_Manager::TEXT,
884 'default' => esc_html__( 'Read More', 'easy-elements' ),
885 'condition' => [
886 'show_read_more' => 'yes',
887 ],
888 ]
889 );
890
891 $this->add_control(
892 'read_more_icon',
893 [
894 'label' => esc_html__( 'Read More Icon', 'easy-elements' ),
895 'type' => \Elementor\Controls_Manager::ICONS,
896 'default' => [
897 'value' => '',
898 'library' => 'fa-solid',
899 ],
900 'condition' => [
901 'show_read_more' => 'yes',
902 ],
903 ]
904 );
905
906 $this->add_control(
907 'read_more_icon_position',
908 [
909 'label' => esc_html__( 'Icon Position', 'easy-elements' ),
910 'type' => \Elementor\Controls_Manager::SELECT,
911 'default' => 'after',
912 'options' => [
913 'before' => esc_html__( 'Before Text', 'easy-elements' ),
914 'after' => esc_html__( 'After Text', 'easy-elements' ),
915 ],
916 'condition' => [
917 'show_read_more' => 'yes',
918 ],
919 ]
920 );
921
922 $this->start_controls_tabs( 'read_more_button_style_tabs' );
923
924 // Normal State
925 $this->start_controls_tab(
926 'button_style_normal',
927 [
928 'label' => esc_html__( 'Normal', 'easy-elements' ),
929 ]
930 );
931
932 $this->add_control(
933 'button_text_color',
934 [
935 'label' => esc_html__( 'Color', 'easy-elements' ),
936 'type' => \Elementor\Controls_Manager::COLOR,
937 'selectors' => [
938 '{{WRAPPER}} .eel--read-more a' => 'color: {{VALUE}};',
939 ],
940 ]
941 );
942
943 $this->add_group_control(
944 \Elementor\Group_Control_Typography::get_type(),
945 [
946 'name' => 'button_typography',
947 'selector' => '{{WRAPPER}} .eel--read-more a',
948 ]
949 );
950
951 $this->add_group_control(
952 \Elementor\Group_Control_Background::get_type(),
953 [
954 'name' => 'eel_btn_background',
955 'label' => __( 'Button Background', 'easy-elements' ),
956 'types' => [ 'classic', 'gradient' ],
957 'selector' => '{{WRAPPER}} .eel--read-more a',
958 ]
959 );
960
961 $this->add_group_control(
962 \Elementor\Group_Control_Border::get_type(),
963 [
964 'name' => 'button_border',
965 'selector' => '{{WRAPPER}} .eel--read-more a',
966 ]
967 );
968
969 $this->add_responsive_control(
970 'button_border_radius',
971 [
972 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
973 'type' => \Elementor\Controls_Manager::DIMENSIONS,
974 'size_units' => [ 'px', '%' ],
975 'selectors' => [
976 '{{WRAPPER}} .eel--read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
977 ],
978 ]
979 );
980
981 $this->add_responsive_control(
982 'button_padding',
983 [
984 'label' => esc_html__( 'Padding', 'easy-elements' ),
985 'type' => \Elementor\Controls_Manager::DIMENSIONS,
986 'size_units' => [ 'px', 'em', '%' ],
987 'selectors' => [
988 '{{WRAPPER}} .eel--read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
989 ],
990 ]
991 );
992
993 $this->add_responsive_control(
994 'button_margin',
995 [
996 'label' => esc_html__( 'Margin', 'easy-elements' ),
997 'type' => \Elementor\Controls_Manager::DIMENSIONS,
998 'size_units' => [ 'px', 'em', '%' ],
999 'selectors' => [
1000 '{{WRAPPER}} .eel--read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1001 ],
1002 ]
1003 );
1004
1005 $this->end_controls_tab();
1006
1007 $this->start_controls_tab(
1008 'button_style_hover',
1009 [
1010 'label' => esc_html__( 'Hover', 'easy-elements' ),
1011 ]
1012 );
1013
1014 $this->add_control(
1015 'button_text_color_hover',
1016 [
1017 'label' => esc_html__( 'Color', 'easy-elements' ),
1018 'type' => \Elementor\Controls_Manager::COLOR,
1019 'selectors' => [
1020 '{{WRAPPER}} .eel--read-more a:hover' => 'color: {{VALUE}};',
1021 ],
1022 ]
1023 );
1024
1025 $this->add_control(
1026 'button_bg_color_hover',
1027 [
1028 'label' => esc_html__( 'Background Color', 'easy-elements' ),
1029 'type' => \Elementor\Controls_Manager::COLOR,
1030 'selectors' => [
1031 '{{WRAPPER}} .eel--read-more a:hover' => 'background-color: {{VALUE}};',
1032 ],
1033 ]
1034 );
1035
1036 $this->add_group_control(
1037 \Elementor\Group_Control_Border::get_type(),
1038 [
1039 'name' => 'button_border_hover',
1040 'selector' => '{{WRAPPER}} .eel--read-more a:hover',
1041 ]
1042 );
1043
1044 $this->end_controls_tab();
1045
1046 $this->end_controls_tabs();
1047
1048 $this->add_responsive_control(
1049 'btn_icon_offset',
1050 [
1051 'label' => esc_html__( 'Icon Offset (Vertical)', 'easy-elements' ),
1052 'type' => \Elementor\Controls_Manager::SLIDER,
1053 'size_units' => [ 'px' ],
1054 'range' => [
1055 'px' => [
1056 'min' => -50,
1057 'max' => 100,
1058 ],
1059 ],
1060 'selectors' => [
1061 '{{WRAPPER}} .eel--read-more-icon.after' => 'top: {{SIZE}}{{UNIT}};',
1062 ],
1063 'condition' => [
1064 'show_read_more' => 'yes',
1065 ],
1066 ]
1067 );
1068
1069 $this->add_responsive_control(
1070 'btn_icon_offset_ho',
1071 [
1072 'label' => esc_html__( 'Icon Offset (Horizontal)', 'easy-elements' ),
1073 'type' => \Elementor\Controls_Manager::SLIDER,
1074 'size_units' => [ 'px' ],
1075 'range' => [
1076 'px' => [
1077 'min' => -50,
1078 'max' => 100,
1079 ],
1080 ],
1081 'selectors' => [
1082 '{{WRAPPER}} .eel--read-more-icon.after' => 'left: {{SIZE}}{{UNIT}};',
1083 ],
1084 'condition' => [
1085 'show_read_more' => 'yes',
1086 ],
1087 ]
1088 );
1089
1090 $this->end_controls_section();
1091
1092 $this->start_controls_section(
1093 '_section_button_icon',
1094 [
1095 'label' => esc_html__( 'Only Icon Button Settings', 'easy-elements' ),
1096 'tab' => Controls_Manager::TAB_CONTENT,
1097 ]
1098 );
1099
1100 $this->add_control(
1101 'only_icon_show',
1102 [
1103 'label' => esc_html__( 'Show Icon', 'easy-elements' ),
1104 'type' => \Elementor\Controls_Manager::SWITCHER,
1105 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
1106 'label_off' => esc_html__( 'No', 'easy-elements' ),
1107 'return_value' => 'yes',
1108 'default' => '',
1109 ]
1110 );
1111
1112 $this->add_control(
1113 'only_icon',
1114 [
1115 'label' => esc_html__( 'Icon', 'easy-elements' ),
1116 'type' => \Elementor\Controls_Manager::ICONS,
1117 'default' => [
1118 'value' => '',
1119 'library' => 'fa-solid',
1120 ],
1121 ]
1122 );
1123
1124 $this->start_controls_tabs( 'button_style_tabs' );
1125
1126 $this->start_controls_tab(
1127 'icon_btn_style_normal',
1128 [
1129 'label' => __( 'Normal', 'easy-elements' ),
1130 ]
1131 );
1132
1133 $this->add_control(
1134 'icon_color',
1135 [
1136 'label' => __( 'Color', 'easy-elements' ),
1137 'type' => \Elementor\Controls_Manager::COLOR,
1138 'selectors' => [
1139 '{{WRAPPER}} .eel--button-icon svg, {{WRAPPER}} .eel--button-icon i' => 'color: {{VALUE}}; fill: {{VALUE}};',
1140 ],
1141 ]
1142 );
1143
1144 $this->add_group_control(
1145 \Elementor\Group_Control_Background::get_type(),
1146 [
1147 'name' => 'eel_iocn_background',
1148 'label' => __( 'Button Background', 'easy-elements' ),
1149 'types' => [ 'classic', 'gradient' ],
1150 'selector' => '{{WRAPPER}} .eel--button-icon',
1151 ]
1152 );
1153
1154 $this->add_group_control(
1155 \Elementor\Group_Control_Border::get_type(),
1156 [
1157 'name' => 'icon_btn_border',
1158 'label' => __( 'Button Border', 'easy-elements' ),
1159 'selector' => '{{WRAPPER}} .eel--button-icon',
1160 ]
1161 );
1162
1163 $this->add_control(
1164 'icon_border_radius',
1165 [
1166 'label' => __( 'Border Radius', 'easy-elements' ),
1167 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1168 'size_units' => [ 'px', '%' ],
1169 'selectors' => [
1170 '{{WRAPPER}} .eel--button-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1171 ],
1172 ]
1173 );
1174
1175 $this->end_controls_tab();
1176
1177 $this->start_controls_tab(
1178 'icon_btn_style_hover',
1179 [
1180 'label' => __( 'Hover', 'easy-elements' ),
1181 ]
1182 );
1183
1184 $this->add_control(
1185 'icon_color_hover',
1186 [
1187 'label' => __( 'Color', 'easy-elements' ),
1188 'type' => \Elementor\Controls_Manager::COLOR,
1189 'selectors' => [
1190 '{{WRAPPER}} .eel--button-icon:hover svg, {{WRAPPER}} .eel--button-icon:hover i' => 'color: {{VALUE}}; fill: {{VALUE}};',
1191 ],
1192 ]
1193 );
1194
1195 $this->add_group_control(
1196 \Elementor\Group_Control_Background::get_type(),
1197 [
1198 'name' => 'eel_iocn_background_hover',
1199 'label' => __( 'Button Background', 'easy-elements' ),
1200 'types' => [ 'classic', 'gradient' ],
1201 'selector' => '{{WRAPPER}} .eel--button-icon:hover',
1202 ]
1203 );
1204
1205 $this->end_controls_tab();
1206 $this->end_controls_tabs();
1207 $this->end_controls_section();
1208
1209
1210 $this->start_controls_section(
1211 'section_pagination_settings',
1212 [
1213 'label' => __( 'Pagination', 'easy-elements' ),
1214 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
1215 ]
1216 );
1217
1218 $this->add_control(
1219 'show_pagination',
1220 [
1221 'label' => esc_html__( 'Show Pagination', 'easy-elements' ),
1222 'type' => Controls_Manager::SWITCHER,
1223 'label_on' => esc_html__( 'Show', 'easy-elements' ),
1224 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
1225 'return_value' => 'yes',
1226 'default' => 'yes',
1227 ]
1228 );
1229
1230 $this->add_responsive_control( 'pagination_top_spacing', [
1231 'label' => esc_html__( 'Top Spacing', 'easy-elements' ),
1232 'type' => Controls_Manager::SLIDER,
1233 'range' => [ 'px' => [ 'min' => 0, 'max' => 100 ] ],
1234 'selectors' => [ '{{WRAPPER}} .eel-blog-pagination' => 'margin-top: {{SIZE}}{{UNIT}};' ],
1235 'condition' => [ 'show_pagination' => 'yes' ],
1236 ]);
1237
1238 $this->add_responsive_control( 'pagination_gap', [
1239 'label' => esc_html__( 'Gap', 'easy-elements' ),
1240 'type' => Controls_Manager::SLIDER,
1241 'range' => [ 'px' => [ 'min' => 0, 'max' => 20 ] ],
1242 'selectors' => [ '{{WRAPPER}} .eel-blog-pagination ul' => 'gap: {{SIZE}}{{UNIT}};' ],
1243 'condition' => [ 'show_pagination' => 'yes' ],
1244 ]);
1245
1246 $this->start_controls_tabs( 'pagination__tabs' );
1247
1248 $this->start_controls_tab(
1249 'pagination__normal',
1250 [
1251 'label' => __( 'Normal', 'easy-elements' ),
1252 ]
1253 );
1254
1255 $this->add_control(
1256 'pagination_color',
1257 [
1258 'label' => esc_html__( 'Color', 'easy-elements' ),
1259 'type' => \Elementor\Controls_Manager::COLOR,
1260 'selectors' => [
1261 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'color: {{VALUE}};',
1262 ],
1263 ]
1264 );
1265
1266 $this->add_group_control(
1267 \Elementor\Group_Control_Background::get_type(),
1268 [
1269 'name' => 'pagination_background',
1270 'types' => [ 'classic', 'gradient' ],
1271 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1272 ]
1273 );
1274
1275 $this->add_group_control(
1276 \Elementor\Group_Control_Typography::get_type(),
1277 [
1278 'name' => 'pagination_typography',
1279 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1280 ]
1281 );
1282
1283 $this->add_group_control(
1284 \Elementor\Group_Control_Border::get_type(),
1285 [
1286 'name' => 'pagination_border',
1287 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a',
1288 ]
1289 );
1290
1291 $this->add_responsive_control(
1292 'pagination_border_radius',
1293 [
1294 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1295 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1296 'size_units' => [ 'px', '%' ],
1297 'selectors' => [
1298 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1299 ],
1300 ]
1301 );
1302
1303 $this->add_responsive_control(
1304 'pagination_width',
1305 [
1306 'label' => esc_html__( 'Width', 'easy-elements' ),
1307 'type' => \Elementor\Controls_Manager::SLIDER,
1308 'size_units' => [ 'px' ],
1309 'range' => [
1310 'px' => [
1311 'min' => 40,
1312 'max' => 100,
1313 ],
1314 ],
1315 'selectors' => [
1316 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1317 ],
1318 'condition' => [
1319 'show_pagination' => 'yes',
1320 ],
1321 ]
1322 );
1323
1324 $this->add_responsive_control( 'pagination_padding', [
1325 'label' => esc_html__( 'Padding', 'easy-elements' ),
1326 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1327 'size_units' => [ 'px', 'em' ],
1328 'selectors' => [
1329 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1330 ],
1331 ]);
1332
1333 $this->add_group_control(
1334 \Elementor\Group_Control_Box_Shadow::get_type(),
1335 [
1336 'name' => 'pagination_box_shadow',
1337 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1338 ]
1339 );
1340
1341 $this->add_control(
1342 'pagination_alignment',
1343 [
1344 'label' => __( 'Alignment', 'easy-elements' ),
1345 'type' => \Elementor\Controls_Manager::CHOOSE,
1346 'options' => [
1347 'left' => [
1348 'title' => __( 'Left', 'easy-elements' ),
1349 'icon' => 'eicon-text-align-left',
1350 ],
1351 'center' => [
1352 'title' => __( 'Center', 'easy-elements' ),
1353 'icon' => 'eicon-text-align-center',
1354 ],
1355 'right' => [
1356 'title' => __( 'Right', 'easy-elements' ),
1357 'icon' => 'eicon-text-align-right',
1358 ],
1359 ],
1360 'default' => 'center',
1361 'toggle' => true,
1362 'selectors' => [
1363 '{{WRAPPER}} .eel-blog-pagination' => 'text-align: {{VALUE}};',
1364 ],
1365 ]
1366 );
1367
1368 $this->end_controls_tab();
1369
1370 $this->start_controls_tab(
1371 'pagination__hover',
1372 [
1373 'label' => __( 'Hover', 'easy-elements' ),
1374 ]
1375 );
1376
1377 $this->add_control(
1378 'pagination_color_current',
1379 [
1380 'label' => esc_html__( 'Color', 'easy-elements' ),
1381 'type' => \Elementor\Controls_Manager::COLOR,
1382 'selectors' => [
1383 '{{WRAPPER}} .eel-blog-pagination ul li a:hover, {{WRAPPER}} .eel-blog-pagination ul li span.current' => 'color: {{VALUE}};',
1384 ],
1385 ]
1386 );
1387
1388 $this->add_group_control(
1389 \Elementor\Group_Control_Background::get_type(),
1390 [
1391 'name' => 'pagination_background_current',
1392 'types' => [ 'classic', 'gradient' ],
1393 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li span.current, {{WRAPPER}} .eel-blog-pagination ul li a:hover',
1394 ]
1395 );
1396
1397 $this->add_group_control(
1398 \Elementor\Group_Control_Border::get_type(),
1399 [
1400 'name' => 'pagination_border_hover',
1401 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li span.current, {{WRAPPER}} .eel-blog-pagination ul li a:hover',
1402 ]
1403 );
1404
1405 $this->add_group_control(
1406 \Elementor\Group_Control_Box_Shadow::get_type(),
1407 [
1408 'name' => 'pagination_hover_box_shadow',
1409 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li span.current, {{WRAPPER}} .eel-blog-pagination ul li a:hover',
1410 ]
1411 );
1412
1413 $this->end_controls_tab();
1414 $this->end_controls_tabs();
1415 $this->end_controls_section();
1416
1417
1418 $this->start_controls_section(
1419 'section_item_style',
1420 [
1421 'label' => __( 'Items', 'easy-elements' ),
1422 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1423 ]
1424 );
1425
1426 $this->add_group_control(
1427 \Elementor\Group_Control_Background::get_type(),
1428 [
1429 'name' => 'item_background',
1430 'label' => __( 'Item Background', 'easy-elements' ),
1431 'types' => [ 'classic', 'gradient' ],
1432 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner',
1433 ]
1434 );
1435
1436 $this->add_responsive_control(
1437 'item_padding',
1438 [
1439 'label' => __( 'Padding', 'easy-elements' ),
1440 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1441 'size_units' => [ 'px', 'em', '%' ],
1442 'selectors' => [
1443 '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1444 ],
1445 ]
1446 );
1447
1448 $this->add_responsive_control(
1449 'item_border_radius',
1450 [
1451 'label' => __( 'Border Radius', 'easy-elements' ),
1452 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1453 'size_units' => [ 'px', '%' ],
1454 'selectors' => [
1455 '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1456 ],
1457 ]
1458 );
1459
1460 $this->add_group_control(
1461 \Elementor\Group_Control_Border::get_type(),
1462 [
1463 'name' => 'item_border',
1464 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner',
1465 ]
1466 );
1467
1468 $this->end_controls_section();
1469
1470 $this->start_controls_section(
1471 'section_conten_style',
1472 [
1473 'label' => __( 'Content Part', 'easy-elements' ),
1474 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1475 ]
1476 );
1477
1478 $this->add_group_control(
1479 \Elementor\Group_Control_Background::get_type(),
1480 [
1481 'name' => 'content_background',
1482 'label' => __( 'Item Background', 'easy-elements' ),
1483 'types' => [ 'classic', 'gradient' ],
1484 'selector' => '{{WRAPPER}} .ee--blog-content-wrap',
1485 ]
1486 );
1487
1488 $this->add_responsive_control(
1489 'content_padding',
1490 [
1491 'label' => __( 'Padding', 'easy-elements' ),
1492 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1493 'size_units' => [ 'px', 'em', '%' ],
1494 'selectors' => [
1495 '{{WRAPPER}} .ee--blog-content-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1496 ],
1497 ]
1498 );
1499
1500 $this->add_responsive_control(
1501 'content_border_radius',
1502 [
1503 'label' => __( 'Border Radius', 'easy-elements' ),
1504 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1505 'size_units' => [ 'px', '%' ],
1506 'selectors' => [
1507 '{{WRAPPER}} .ee--blog-content-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1508 ],
1509 ]
1510 );
1511
1512 $this->end_controls_section();
1513
1514 $this->start_controls_section(
1515 'section_title_style',
1516 [
1517 'label' => __( 'Title', 'easy-elements' ),
1518 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1519 ]
1520 );
1521
1522 // Typography
1523 $this->add_group_control(
1524 \Elementor\Group_Control_Typography::get_type(),
1525 [
1526 'name' => 'title_typography',
1527 'selector' => '{{WRAPPER}} .ee--blog-title',
1528 ]
1529 );
1530
1531 // Tabs for Normal and Hover state
1532 $this->start_controls_tabs( 'title_color_tabs' );
1533
1534 // Normal
1535 $this->start_controls_tab(
1536 'title_color_normal',
1537 [
1538 'label' => esc_html__( 'Normal', 'easy-elements' ),
1539 ]
1540 );
1541 $this->add_control(
1542 'title_color',
1543 [
1544 'label' => esc_html__( 'Color', 'easy-elements' ),
1545 'type' => \Elementor\Controls_Manager::COLOR,
1546 'selectors' => [
1547 '{{WRAPPER}} .ee--blog-title' => 'color: {{VALUE}};',
1548 ],
1549 ]
1550 );
1551
1552
1553 $this->add_responsive_control(
1554 'title_margin',
1555 [
1556 'label' => __( 'Margin', 'easy-elements' ),
1557 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1558 'size_units' => [ 'px', 'em', '%' ],
1559 'selectors' => [
1560 '{{WRAPPER}} .ee--blog-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1561 ],
1562 ]
1563 );
1564
1565 $this->end_controls_tab();
1566
1567 // Hover
1568 $this->start_controls_tab(
1569 'title_color_hover',
1570 [
1571 'label' => esc_html__( 'Hover', 'easy-elements' ),
1572 ]
1573 );
1574 $this->add_control(
1575 'title_hover_color',
1576 [
1577 'label' => esc_html__( 'Hover Color', 'easy-elements' ),
1578 'type' => \Elementor\Controls_Manager::COLOR,
1579 'selectors' => [
1580 '{{WRAPPER}} .ee--blog-title:hover a' => 'color: {{VALUE}};',
1581 ],
1582 ]
1583 );
1584 $this->end_controls_tab();
1585
1586 $this->end_controls_tabs();
1587
1588 $this->end_controls_section();
1589
1590
1591 $this->start_controls_section(
1592 'section_excerpt_style',
1593 [
1594 'label' => __( 'Excerpt', 'easy-elements' ),
1595 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1596 ]
1597 );
1598
1599 $this->add_control(
1600 'excerpt_color',
1601 [
1602 'label' => esc_html__( 'Color', 'easy-elements' ),
1603 'type' => \Elementor\Controls_Manager::COLOR,
1604 'selectors' => [
1605 '{{WRAPPER}} .eel--blog-excerpt' => 'color: {{VALUE}};',
1606 ],
1607 ]
1608 );
1609
1610 $this->add_group_control(
1611 \Elementor\Group_Control_Typography::get_type(),
1612 [
1613 'name' => 'excerpt_typography',
1614 'selector' => '{{WRAPPER}} .eel--blog-excerpt',
1615 ]
1616 );
1617
1618 $this->add_responsive_control(
1619 'excerpt_margin',
1620 [
1621 'label' => __( 'Margin', 'easy-elements' ),
1622 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1623 'size_units' => [ 'px', 'em', '%' ],
1624 'selectors' => [
1625 '{{WRAPPER}} .eel--blog-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1626 ],
1627 ]
1628 );
1629
1630 $this->end_controls_section();
1631
1632
1633 $this->start_controls_section(
1634 'section_meta_style',
1635 [
1636 'label' => __( 'Meta', 'easy-elements' ),
1637 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1638 ]
1639 );
1640
1641 $this->add_control(
1642 'meta_text_color',
1643 [
1644 'label' => __( 'Color', 'easy-elements' ),
1645 'type' => \Elementor\Controls_Manager::COLOR,
1646 'selectors' => [
1647 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li *, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li i, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li svg' => 'color: {{VALUE}}; fill: {{VALUE}};',
1648 ],
1649 ]
1650 );
1651
1652 $this->add_control(
1653 'meta_icon_color',
1654 [
1655 'label' => __( 'Icon Color', 'easy-elements' ),
1656 'type' => \Elementor\Controls_Manager::COLOR,
1657 'selectors' => [
1658 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li i' => 'color: {{VALUE}};',
1659 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li svg' => 'color: {{VALUE}}; fill: {{VALUE}};',
1660 ],
1661 ]
1662 );
1663
1664 $this->add_responsive_control(
1665 'meta_icon_size',
1666 [
1667 'label' => __( 'Icon Size', 'easy-elements' ),
1668 'type' => \Elementor\Controls_Manager::SLIDER,
1669 'range' => [ 'px' => [ 'min' => 8, 'max' => 30 ] ],
1670 'selectors' => [
1671 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li i' => 'font-size: {{SIZE}}{{UNIT}};',
1672 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1673 ],
1674 ]
1675 );
1676
1677 $this->add_responsive_control(
1678 'meta_icon_spacing',
1679 [
1680 'label' => __( 'Icon Spacing', 'easy-elements' ),
1681 'type' => \Elementor\Controls_Manager::SLIDER,
1682 'range' => [ 'px' => [ 'min' => 0, 'max' => 20 ] ],
1683 'selectors' => [
1684 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li i, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li svg' => 'margin-right: {{SIZE}}{{UNIT}};',
1685 ],
1686 'separator' => 'after',
1687 ]
1688 );
1689
1690 $this->add_group_control(
1691 \Elementor\Group_Control_Typography::get_type(),
1692 [
1693 'name' => 'meta_typography',
1694 'label' => __( 'Typography', 'easy-elements' ),
1695 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li',
1696 ]
1697 );
1698
1699 $this->add_responsive_control(
1700 'meta_spacing',
1701 [
1702 'label' => esc_html__( 'Meta Spacing', 'easy-elements' ),
1703 'type' => \Elementor\Controls_Manager::SLIDER,
1704 'size_units' => [ 'px' ],
1705 'range' => [
1706 'px' => [
1707 'min' => 0,
1708 'max' => 100,
1709 ],
1710 ],
1711 'selectors' => [
1712 '{{WRAPPER}} .eel--blog-meta li+li' => 'margin-left: {{SIZE}}{{UNIT}}; padding-left: {{SIZE}}{{UNIT}};',
1713 ],
1714 ]
1715 );
1716
1717
1718 $this->end_controls_section();
1719
1720 // Date Badge Style
1721 $this->start_controls_section(
1722 'date_badge_style',
1723 [
1724 'label' => __( 'Date Badge', 'easy-elements' ),
1725 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1726 'condition' => [
1727 'show_date_on_top' => 'yes',
1728 ],
1729 ]
1730 );
1731
1732 $this->add_control(
1733 'date_text_color_badge',
1734 [
1735 'label' => __( 'Color', 'easy-elements' ),
1736 'type' => \Elementor\Controls_Manager::COLOR,
1737 'selectors' => [
1738 '{{WRAPPER}} .eel--blog-date-top, {{WRAPPER}} .eel--blog-date-top h4' => 'color: {{VALUE}};',
1739 ],
1740 ]
1741 );
1742
1743 $this->add_group_control(
1744 \Elementor\Group_Control_Background::get_type(),
1745 [
1746 'name' => 'eel_date_background_badge',
1747 'label' => __( 'Background', 'easy-elements' ),
1748 'types' => [ 'classic', 'gradient' ],
1749 'selector' => '{{WRAPPER}} .eel--blog-date-top',
1750 ]
1751 );
1752
1753 $this->add_group_control(
1754 \Elementor\Group_Control_Typography::get_type(),
1755 [
1756 'name' => 'date_typography_badge_top',
1757 'label' => __( 'Day Typography', 'easy-elements' ),
1758 'selector' => '{{WRAPPER}} .eel--blog-date-top h4',
1759 ]
1760 );
1761
1762 $this->add_group_control(
1763 \Elementor\Group_Control_Typography::get_type(),
1764 [
1765 'name' => 'date_typography_badge_btm',
1766 'label' => __( 'Month Typography', 'easy-elements' ),
1767 'selector' => '{{WRAPPER}} .eel--blog-date-top',
1768 ]
1769 );
1770
1771 $this->add_responsive_control(
1772 'date_border_radius_badge',
1773 [
1774 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1775 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1776 'size_units' => [ 'px', '%' ],
1777 'selectors' => [
1778 '{{WRAPPER}} .eel--blog-date-top' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1779 ],
1780 ]
1781 );
1782
1783 $this->add_responsive_control(
1784 'date_padding_badge',
1785 [
1786 'label' => esc_html__( 'Padding', 'easy-elements' ),
1787 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1788 'size_units' => [ 'px', '%' ],
1789 'selectors' => [
1790 '{{WRAPPER}} .eel--blog-date-top' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1791 ],
1792 ]
1793 );
1794
1795 $this->add_responsive_control(
1796 'date_badge_position_horizontal',
1797 [
1798 'label' => esc_html__('Offset Horizontal', 'easy-elements'),
1799 'type' => \Elementor\Controls_Manager::SLIDER,
1800 'size_units' => [ 'px', '%' ],
1801 'range' => [
1802 'px' => [ 'min' => -400, 'max' => 400, 'step' => 1 ],
1803 '%' => [ 'min' => -100, 'max' => 100 ],
1804 ],
1805 'selectors' => [
1806 '{{WRAPPER}} .eel--blog-date-top' => 'right: {{SIZE}}{{UNIT}};',
1807 ],
1808 ]
1809 );
1810
1811 $this->add_responsive_control(
1812 'date_badge_position_vertical',
1813 [
1814 'label' => esc_html__('Offset Vertical', 'easy-elements'),
1815 'type' => \Elementor\Controls_Manager::SLIDER,
1816 'size_units' => [ 'px', '%' ],
1817 'range' => [
1818 'px' => [ 'min' => -400, 'max' => 400, 'step' => 1 ],
1819 '%' => [ 'min' => -100, 'max' => 100 ],
1820 ],
1821 'selectors' => [
1822 '{{WRAPPER}} .eel--blog-date-top' => 'top: {{SIZE}}{{UNIT}};',
1823 ],
1824 ]
1825 );
1826
1827 $this->end_controls_section();
1828
1829 // Category Badge Style
1830 $this->start_controls_section(
1831 'category_badge_style',
1832 [
1833 'label' => __( 'Category Badge', 'easy-elements' ),
1834 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1835 'condition' => [
1836 'show_category_badge' => 'yes',
1837 ],
1838 ]
1839 );
1840
1841 $this->add_control(
1842 'category_badge_color',
1843 [
1844 'label' => __( 'Color', 'easy-elements' ),
1845 'type' => \Elementor\Controls_Manager::COLOR,
1846 'selectors' => [
1847 '{{WRAPPER}} .eel--blog-category-badge a' => 'color: {{VALUE}};',
1848 ],
1849 ]
1850 );
1851
1852 $this->add_group_control(
1853 \Elementor\Group_Control_Background::get_type(),
1854 [
1855 'name' => 'category_badge_background',
1856 'label' => __( 'Background', 'easy-elements' ),
1857 'types' => [ 'classic', 'gradient' ],
1858 'selector' => '{{WRAPPER}} .eel--blog-category-badge',
1859 ]
1860 );
1861
1862 $this->add_group_control(
1863 \Elementor\Group_Control_Typography::get_type(),
1864 [
1865 'name' => 'category_badge_typography',
1866 'label' => __( 'Typography', 'easy-elements' ),
1867 'selector' => '{{WRAPPER}} .eel--blog-category-badge a',
1868 ]
1869 );
1870
1871 $this->add_responsive_control(
1872 'category_badge_border_radius',
1873 [
1874 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1875 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1876 'size_units' => [ 'px', '%' ],
1877 'selectors' => [
1878 '{{WRAPPER}} .eel--blog-category-badge' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1879 ],
1880 ]
1881 );
1882
1883 $this->add_responsive_control(
1884 'category_badge_padding',
1885 [
1886 'label' => esc_html__( 'Padding', 'easy-elements' ),
1887 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1888 'size_units' => [ 'px', '%' ],
1889 'selectors' => [
1890 '{{WRAPPER}} .eel--blog-category-badge' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1891 ],
1892 ]
1893 );
1894
1895 $this->add_responsive_control(
1896 'category_badge_position_horizontal',
1897 [
1898 'label' => esc_html__('Offset Horizontal', 'easy-elements'),
1899 'type' => \Elementor\Controls_Manager::SLIDER,
1900 'size_units' => [ 'px', '%' ],
1901 'range' => [
1902 'px' => [ 'min' => -400, 'max' => 400, 'step' => 1 ],
1903 '%' => [ 'min' => -100, 'max' => 100 ],
1904 ],
1905 'selectors' => [
1906 '{{WRAPPER}} .eel--blog-category-badge' => 'left: {{SIZE}}{{UNIT}};',
1907 ],
1908 ]
1909 );
1910
1911 $this->add_responsive_control(
1912 'category_badge_position_vertical',
1913 [
1914 'label' => esc_html__('Offset Vertical', 'easy-elements'),
1915 'type' => \Elementor\Controls_Manager::SLIDER,
1916 'size_units' => [ 'px', '%' ],
1917 'range' => [
1918 'px' => [ 'min' => -400, 'max' => 400, 'step' => 1 ],
1919 '%' => [ 'min' => -100, 'max' => 100 ],
1920 ],
1921 'selectors' => [
1922 '{{WRAPPER}} .eel--blog-category-badge' => 'top: {{SIZE}}{{UNIT}};',
1923 ],
1924 ]
1925 );
1926
1927 $this->add_control(
1928 'category_badge_blur',
1929 [
1930 'label' => __( 'Backdrop Blur', 'easy-elements' ),
1931 'type' => \Elementor\Controls_Manager::SLIDER,
1932 'size_units' => [ 'px' ],
1933 'range' => [
1934 'px' => [ 'min' => 0, 'max' => 100, 'step' => 1 ],
1935 ],
1936 'selectors' => [
1937 '{{WRAPPER}} .eel--blog-category-badge' => 'backdrop-filter: blur({{SIZE}}{{UNIT}}); -webkit-backdrop-filter: blur({{SIZE}}{{UNIT}});',
1938 ],
1939 ]
1940 );
1941
1942 $this->end_controls_section();
1943 }
1944
1945 protected function render_blog_meta( $settings ) {
1946 if ( empty( $settings['show_meta'] ) || ! is_array( $settings['show_meta'] ) ) {
1947 return;
1948 }
1949
1950 $show_meta = $settings['show_meta'];
1951
1952 usort( $show_meta, function( $a, $b ) use ( $settings ) {
1953 $order_a = ! empty( $settings['meta_order_' . $a] ) ? (int) $settings['meta_order_' . $a] : 99;
1954 $order_b = ! empty( $settings['meta_order_' . $b] ) ? (int) $settings['meta_order_' . $b] : 99;
1955 return $order_a - $order_b;
1956 });
1957
1958 $eel_separator = ! empty( $settings['eel_separator'] ) ? 'eel--separator--' . esc_attr( $settings['eel_separator'] ) : '';
1959 ?>
1960 <ul class="eel--blog-meta <?php echo esc_attr($eel_separator); ?>">
1961 <?php foreach ( $show_meta as $meta ) :
1962 switch ( $meta ) :
1963 case 'date': ?>
1964 <li class="eel--blog-date">
1965 <?php
1966 if ( ! empty($settings['show_date_icon']) && $settings['show_date_icon'] === 'yes' ) {
1967 if ( empty( $settings['date_icon']['value'] ) ) {
1968 echo '<i class="unicon-calendar"></i>';
1969 } else {
1970 \Elementor\Icons_Manager::render_icon( $settings['date_icon'], [ 'aria-hidden' => 'true' ] );
1971 }
1972 }
1973 echo esc_html( get_the_date() );
1974 ?>
1975 </li>
1976 <?php break;
1977
1978 case 'author':
1979 $author_icon_type = $settings['author_icon_type'] ?? 'icon';
1980 ?>
1981 <li class="eel--blog-author <?php echo $author_icon_type === 'avatar' ? 'eel--has-avatar' : ''; ?>">
1982 <?php
1983 $author_id = get_the_author_meta( 'ID' );
1984 $author_name = get_the_author();
1985 $author_url = get_author_posts_url( $author_id );
1986
1987 if ( $author_icon_type === 'icon' ) {
1988 if ( empty( $settings['author_icon']['value'] ) ) {
1989 echo '<i class="unicon-user"></i>';
1990 } else {
1991 \Elementor\Icons_Manager::render_icon( $settings['author_icon'], [ 'aria-hidden' => 'true' ] );
1992 }
1993 } elseif ( $author_icon_type === 'avatar' ) {
1994 $avatar_size = ! empty( $settings['author_avatar_size']['size'] ) ? (int) $settings['author_avatar_size']['size'] : 22;
1995 echo '<img class="eel--author-avatar" src="' . esc_url( get_avatar_url( $author_id, [ 'size' => $avatar_size * 2 ] ) ) . '" alt="' . esc_attr( $author_name ) . '">';
1996 }
1997
1998 if ( ! empty($settings['show_by_label']) && $settings['show_by_label'] === 'yes' ) {
1999 echo '<em class="eel--meta-by">' . esc_html__( 'By', 'easy-elements' ) . '</em> ';
2000 }
2001
2002 if ( ! empty($settings['author_link_enable']) && $settings['author_link_enable'] === 'yes' ) {
2003 echo '<a class="eel--meta-author" href="' . esc_url( $author_url ) . '">' . esc_html( $author_name ) . '</a>';
2004 } else {
2005 echo '<span class="eel--meta-author">' . esc_html( $author_name ) . '</span>';
2006 }
2007 ?>
2008 </li>
2009 <?php break;
2010
2011 case 'category': ?>
2012 <li class="eel--blog-cat">
2013 <?php
2014 if ( ! empty($settings['show_category_icon']) && $settings['show_category_icon'] === 'yes' ) {
2015 if ( empty( $settings['category_icon']['value'] ) ) {
2016 echo '<i class="unicon-folder"></i>';
2017 } else {
2018 \Elementor\Icons_Manager::render_icon( $settings['category_icon'], [ 'aria-hidden' => 'true' ] );
2019 }
2020 }
2021 the_category( ', ' );
2022 ?>
2023 </li>
2024 <?php break;
2025
2026 case 'comments': ?>
2027 <li class="eel--blog-comments">
2028 <?php
2029 if ( ! empty($settings['show_comments_icon']) && $settings['show_comments_icon'] === 'yes' ) {
2030 if ( empty( $settings['comments_icon']['value'] ) ) {
2031 echo '<i class="unicon-forum"></i>';
2032 } else {
2033 \Elementor\Icons_Manager::render_icon( $settings['comments_icon'], [ 'aria-hidden' => 'true' ] );
2034 }
2035 }
2036 $comments_number = get_comments_number();
2037 echo '<a href="' . esc_url( get_comments_link() ) . '">' . esc_html( $comments_number ) . ' ' . esc_html( _n( 'Comment', 'Comments', $comments_number, 'easy-elements' ) ) . '</a>';
2038 ?>
2039 </li>
2040 <?php break;
2041
2042 case 'read_time': ?>
2043 <li class="eel--blog-read-time">
2044 <?php
2045 if ( ! empty($settings['show_read_time_icon']) && $settings['show_read_time_icon'] === 'yes' ) {
2046 if ( empty( $settings['read_time_icon']['value'] ) ) {
2047 echo '<i class="unicon-time"></i>';
2048 } else {
2049 \Elementor\Icons_Manager::render_icon( $settings['read_time_icon'], [ 'aria-hidden' => 'true' ] );
2050 }
2051 }
2052 $word_count = str_word_count( wp_strip_all_tags( get_the_content() ) );
2053 $reading_time = ceil( $word_count / 80 );
2054 echo esc_html( $reading_time ) . ' ' . esc_html__( 'mins read', 'easy-elements' );
2055 ?>
2056 </li>
2057 <?php break;
2058 endswitch;
2059 endforeach; ?>
2060 </ul>
2061 <?php
2062 }
2063
2064 protected function render() {
2065 $settings = $this->get_settings_for_display();
2066 $node_id = $this->get_id();
2067 $paged_var = 'paged_' . $node_id;
2068
2069 $post_type = !empty($settings['post_type']) ? $settings['post_type'] : 'post';
2070 $title_tag = $settings['title_tag'] ?? 'h3';
2071 $orderby = $settings['orderby'] ?? 'date';
2072 $order = $settings['order'] ?? 'DESC';
2073 $offset_val = !empty($settings['offset']) ? absint($settings['offset']) : 0;
2074 $thumbnail_size = $settings['thumbnail_size'] ?? 'medium';
2075 $title_trim = $settings['title_trim'] ?? 10;
2076 $excerpt_trim = $settings['excerpt_trim'] ?? 20;
2077 $exclude_categories = $settings['exclude_categories'] ?? [];
2078
2079 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
2080 $paged = isset($_GET[$paged_var]) ? max(1, intval($_GET[$paged_var])) : 1;
2081
2082 $posts_per_page = !empty($settings['posts_per_page']) ? $settings['posts_per_page'] : get_option('posts_per_page');
2083
2084 $args = [
2085 'post_type' => $post_type,
2086 'posts_per_page' => $posts_per_page,
2087 'orderby' => $orderby,
2088 'order' => $order,
2089 'paged' => $paged,
2090 'post_status' => 'publish',
2091 ];
2092
2093 if ($offset_val > 0) {
2094 $args['offset'] = $offset_val + ( ($paged - 1) * $posts_per_page );
2095 }
2096
2097 if ( apply_filters( 'easyel/pro_enabled', false ) ) {
2098
2099 $args = apply_filters(
2100 'easyel/apply_user_source_query',
2101 $args,
2102 $settings
2103 );
2104 }
2105
2106 if ($settings['source_type'] === 'category' && !empty($settings['categories'])) {
2107 $args['category__in'] = $settings['categories'];
2108 } elseif ($settings['source_type'] === 'post' && !empty($settings['post__in'])) {
2109 $args['post__in'] = $settings['post__in'];
2110 $args['orderby'] = 'post__in';
2111 }
2112
2113 if (!empty($exclude_categories)) {
2114 $args['category__not_in'] = $exclude_categories;
2115 }
2116
2117 $is_editor = \Elementor\Plugin::$instance->editor->is_edit_mode();
2118
2119 if ( (is_category() || is_tag() || is_tax()) && !$is_editor ) {
2120 global $wp_query;
2121 $query = $wp_query;
2122 } else {
2123 $query = new \WP_Query( $args );
2124 }
2125
2126 if (!$query->have_posts()) {
2127 echo '<p>' . esc_html__('No posts found.', 'easy-elements') . '</p>';
2128 return;
2129 }
2130
2131 echo '<div id="eel-post-grid-' . esc_attr($node_id) . '" class="eel-post-grid-wrap">';
2132 while ($query->have_posts()) : $query->the_post();
2133 $trimmed_title = wp_trim_words(get_the_title(), $title_trim, '...');
2134 $trimmed_excerpt = wp_trim_words(get_the_excerpt(), $excerpt_trim, '...');
2135 ?>
2136 <div class="grid-item">
2137 <div class="grid-item-inner">
2138 <?php if ('yes' === $settings['show_thumbnail']) : ?>
2139 <div class="eel--blog-img">
2140 <a href="<?php the_permalink(); ?>">
2141 <?php if (has_post_thumbnail()) {
2142 the_post_thumbnail($thumbnail_size, ['alt' => get_the_title()]);
2143 } ?>
2144 </a>
2145 </div>
2146 <?php endif; ?>
2147
2148 <?php if( 'yes' === ( $settings['show_date_on_top'] ?? '' ) ): ?>
2149 <div class="eel--blog-date-top">
2150 <h4><?php echo esc_html(get_the_time('d')); ?></h4>
2151 <span><?php echo esc_html(get_the_time('M')); ?></span>
2152 </div>
2153 <?php endif; ?>
2154
2155 <?php if( 'yes' === ( $settings['show_category_badge'] ?? '' ) ) :
2156 $cats = get_the_category();
2157 if ( ! empty( $cats ) ) : ?>
2158 <div class="eel--blog-category-badge">
2159 <?php
2160 $cat_links = [];
2161 foreach ( $cats as $cat ) {
2162 $cat_links[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '">' . esc_html( $cat->name ) . '</a>';
2163 }
2164 echo wp_kses(
2165 implode( ',&nbsp;', $cat_links ),
2166 easyel_allowed_html()
2167 );
2168 ?>
2169 </div>
2170 <?php endif;
2171 endif; ?>
2172
2173 <div class="ee--blog-content-wrap">
2174 <div class="ee--blog-content">
2175 <?php if ('up_title' === $settings['meta_position']) $this->render_blog_meta($settings); ?>
2176 <<?php echo esc_attr($title_tag); ?> class="ee--blog-title">
2177 <a href="<?php the_permalink(); ?>"><?php echo esc_html($trimmed_title); ?></a>
2178 </<?php echo esc_attr($title_tag); ?>>
2179 <?php if ('below_title' === $settings['meta_position']) $this->render_blog_meta($settings); ?>
2180 <?php if ('yes' === $settings['show_excerpt']) : ?>
2181 <div class="eel--blog-excerpt"><?php echo esc_html($trimmed_excerpt); ?></div>
2182 <?php endif; ?>
2183 <?php if ('below_content' === $settings['meta_position']) $this->render_blog_meta($settings); ?>
2184 </div>
2185 </div>
2186 </div>
2187 </div>
2188 <?php
2189 endwhile;
2190 echo '</div>';
2191
2192 if ('yes' === $settings['show_pagination'] && $query->max_num_pages > 1) {
2193 $pagination = paginate_links([
2194 'base' => add_query_arg($paged_var, '%#%'),
2195 'format' => '',
2196 'current' => $paged,
2197 'total' => $query->max_num_pages,
2198 'prev_text' => '&laquo;',
2199 'next_text' => '&raquo;',
2200 'type' => 'list',
2201 ]);
2202
2203 if ($pagination) {
2204 echo '<nav class="eel-blog-pagination">' . wp_kses_post($pagination) . '</nav>';
2205 }
2206 }
2207 wp_reset_postdata();
2208 }
2209 }