PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.0
Easy Elements for Elementor – Addons & Website Templates v1.5.0
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.5.0, at widgets/archive-post/archive-post.php

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