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

1,778 lines 65.5 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 .grid-item' => 'width: calc(100% / {{VALUE}});',
245 ],
246 ]
247 );
248
249 $this->add_responsive_control(
250 'column_padding',
251 [
252 'label' => esc_html__( 'Column Space', 'easy-elements' ),
253 'type' => \Elementor\Controls_Manager::DIMENSIONS,
254 'size_units' => [ 'px', 'em', '%' ],
255 'selectors' => [
256 '{{WRAPPER}} .eel-post-grid-wrap .grid-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
257 ],
258 ]
259 );
260
261 $this->end_controls_section();
262
263 $this->start_controls_section(
264 '_section_grid_query',
265 [
266 'label' => esc_html__( 'Query Settings', 'easy-elements' ),
267 'tab' => Controls_Manager::TAB_CONTENT,
268 ]
269 );
270
271 $is_pro = class_exists( 'Easy_Elements_Pro' );
272 $this->add_control(
273 'post_type',
274 [
275 'label' => esc_html__( 'Post Type', 'easy-elements' ),
276 'type' => Controls_Manager::SELECT,
277 'options' => $is_pro ? $this->get_post_type_options() : [ 'post' => 'Post (Pro Only)' ],
278 'default' => 'post',
279 'description' => $is_pro ? '' : esc_html__( 'This option is available in Pro version.', 'easy-elements' ),
280 ]
281 );
282
283 $this->add_control(
284 'source_type',
285 [
286 'label' => esc_html__( 'Source Type', 'easy-elements' ),
287 'type' => Controls_Manager::SELECT,
288 'options' => [
289 'category' => esc_html__( 'Category', 'easy-elements' ),
290 'post' => esc_html__( 'Specific Posts', 'easy-elements' ),
291 ],
292 'default' => 'category',
293 ]
294 );
295
296
297 $this->add_control(
298 'categories',
299 [
300 'label' => esc_html__( 'Select Categories', 'easy-elements' ),
301 'type' => Controls_Manager::SELECT2,
302 'multiple' => true,
303 'options' => $this->get_all_categories(),
304 'label_block' => true,
305 'condition' => [
306 'source_type' => 'category',
307 ],
308 ]
309 );
310
311 $this->add_control(
312 'post__in',
313 [
314 'label' => esc_html__( 'Select Specific Posts', 'easy-elements' ),
315 'type' => $is_pro ? Controls_Manager::SELECT2 : Controls_Manager::SELECT,
316 'options' => $is_pro ? $this->get_all_posts() : [ '' => esc_html__( 'Pro Version Only', 'easy-elements' ) ],
317 'multiple' => $is_pro ? true : false,
318 'label_block' => true,
319 'description' => $is_pro ? '' : esc_html__( 'This feature is available in the Pro version.', 'easy-elements' ),
320 'condition' => [
321 'source_type' => 'post',
322 ],
323 ]
324 );
325
326
327 $this->add_control(
328 'exclude_posts',
329 [
330 'label' => esc_html__( 'Exclude Posts', 'easy-elements' ),
331 'type' => $is_pro ? \Elementor\Controls_Manager::SELECT2 : \Elementor\Controls_Manager::SELECT,
332 'multiple' => $is_pro ? true : false,
333 'options' => $is_pro ? $this->get_all_posts() : [ '' => esc_html__( 'Pro Version Only', 'easy-elements' ) ],
334 'label_block' => true,
335 'description' => $is_pro ? '' : esc_html__( 'This feature is available in the Pro version.', 'easy-elements' ),
336 'condition' => [
337 'source_type!' => 'post',
338 ],
339 ]
340 );
341
342
343 $this->add_control(
344 'posts_per_page',
345 [
346 'label' => esc_html__( 'Posts Per Page', 'easy-elements' ),
347 'type' => Controls_Manager::NUMBER,
348 'default' => 6,
349 'min' => 1,
350 'max' => 50,
351 ]
352 );
353
354 $this->add_control(
355 'offset',
356 [
357 'label' => esc_html__( 'Offset', 'easy-elements' ),
358 'type' => Controls_Manager::NUMBER,
359 'min' => 0,
360 'max' => 100,
361 'description' => esc_html__( 'Skip posts from the top of the query.', 'easy-elements' ),
362 ]
363 );
364
365 $this->add_control(
366 'orderby',
367 [
368 'label' => esc_html__( 'Order By', 'easy-elements' ),
369 'type' => Controls_Manager::SELECT,
370 'options' => $is_pro
371 ? [
372 'date' => esc_html__( 'Date', 'easy-elements' ),
373 'title' => esc_html__( 'Title', 'easy-elements' ),
374 'rand' => esc_html__( 'Random', 'easy-elements' ),
375 'menu_order' => esc_html__( 'Menu Order', 'easy-elements' ),
376 ]
377 : [ '' => esc_html__( 'Available in Pro version', 'easy-elements' ) ],
378 'default' => $is_pro ? 'date' : '',
379 'description' => $is_pro ? '' : esc_html__( 'This option is available in Pro version.', 'easy-elements' ),
380 'disabled' => ! $is_pro,
381 ]
382 );
383
384 $this->add_control(
385 'order',
386 [
387 'label' => esc_html__( 'Order', 'easy-elements' ),
388 'type' => Controls_Manager::SELECT,
389 'options' => $is_pro
390 ? [
391 'DESC' => esc_html__( 'Descending', 'easy-elements' ),
392 'ASC' => esc_html__( 'Ascending', 'easy-elements' ),
393 ]
394 : [ '' => esc_html__( 'Available in Pro version', 'easy-elements' ) ],
395 'default' => $is_pro ? 'DESC' : '',
396 'description' => $is_pro ? '' : esc_html__( 'This option is available in Pro version.', 'easy-elements' ),
397 'disabled' => ! $is_pro,
398 ]
399 );
400
401
402 $this->end_controls_section();
403
404
405 $this->start_controls_section(
406 '_section_meta',
407 [
408 'label' => esc_html__( 'Meta Settings', 'easy-elements' ),
409 'tab' => Controls_Manager::TAB_CONTENT,
410 ]
411 );
412
413 $this->add_control(
414 'show_meta',
415 [
416 'label' => esc_html__('Show Meta', 'easy-elements'),
417 'type' => \Elementor\Controls_Manager::SELECT2,
418 'multiple' => true,
419 'options' => [
420 'date' => esc_html__('Date', 'easy-elements'),
421 'author' => esc_html__('Author', 'easy-elements'),
422 'category' => esc_html__('Category', 'easy-elements'),
423 'comments' => esc_html__('Comments', 'easy-elements'),
424 'read_time' => esc_html__('Reading Time', 'easy-elements'),
425 ],
426 'default' => ['date', 'author'],
427 'label_block' => true,
428 ]
429 );
430
431 $this->add_control(
432 'show_date_icon',
433 [
434 'label' => esc_html__( 'Show Date Icon', 'easy-elements' ),
435 'type' => Controls_Manager::SWITCHER,
436 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
437 'label_off' => esc_html__( 'No', 'easy-elements' ),
438 'default' => 'yes',
439 'condition' => [
440 'show_meta' => 'date',
441 ]
442 ]
443 );
444
445 $this->add_control(
446 'date_icon',
447 [
448 'label' => esc_html__( 'Date Icon', 'easy-elements' ),
449 'type' => \Elementor\Controls_Manager::ICONS,
450 'default' => [
451 'value' => '',
452 'library' => 'fa-solid',
453 ],
454 'condition' => [
455 'show_date_icon' => 'yes',
456 'show_meta' => 'date',
457 ],
458 ]
459 );
460
461 $this->add_control(
462 'show_by_label',
463 [
464 'label' => __( 'Show "By" Label', 'easy-elements' ),
465 'type' => \Elementor\Controls_Manager::SWITCHER,
466 'label_on' => __( 'Yes', 'easy-elements' ),
467 'label_off' => __( 'No', 'easy-elements' ),
468 'return_value' => 'yes',
469 'default' => 'yes',
470 ]
471 );
472
473 $this->add_control(
474 'author_link_enable',
475 [
476 'label' => __( 'Author Link', 'easy-elements' ),
477 'type' => \Elementor\Controls_Manager::SWITCHER,
478 'label_on' => __( 'Yes', 'easy-elements' ),
479 'label_off' => __( 'No', 'easy-elements' ),
480 'return_value' => 'yes',
481 'default' => '',
482 ]
483 );
484
485
486 $this->add_control(
487 'show_author_icon',
488 [
489 'label' => esc_html__( 'Show Author Icon', 'easy-elements' ),
490 'type' => Controls_Manager::SWITCHER,
491 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
492 'label_off' => esc_html__( 'No', 'easy-elements' ),
493 'default' => 'yes',
494 'condition' => [
495 'show_meta' => 'author',
496 ]
497 ]
498 );
499
500 $this->add_control(
501 'author_icon',
502 [
503 'label' => esc_html__( 'Author Icon', 'easy-elements' ),
504 'type' => \Elementor\Controls_Manager::ICONS,
505 'default' => [
506 'value' => '',
507 'library' => 'fa-solid',
508 ],
509 'condition' => [
510 'show_author_icon' => 'yes',
511 'show_meta' => 'author',
512 ],
513 ]
514 );
515
516
517 $this->add_control(
518 'show_category_icon',
519 [
520 'label' => esc_html__( 'Show Category Icon', 'easy-elements' ),
521 'type' => Controls_Manager::SWITCHER,
522 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
523 'label_off' => esc_html__( 'No', 'easy-elements' ),
524 'default' => 'yes',
525 'condition' => [
526 'show_meta' => 'category',
527 ]
528 ]
529 );
530
531 $this->add_control(
532 'category_icon',
533 [
534 'label' => esc_html__( 'Category Icon', 'easy-elements' ),
535 'type' => \Elementor\Controls_Manager::ICONS,
536 'default' => [
537 'value' => '',
538 'library' => 'fa-solid',
539 ],
540 'condition' => [
541 'show_category_icon' => 'yes',
542 'show_meta' => 'category',
543 ],
544 ]
545 );
546
547 $this->add_control(
548 'show_comments_icon',
549 [
550 'label' => esc_html__( 'Show Comments Icon', 'easy-elements' ),
551 'type' => \Elementor\Controls_Manager::SWITCHER,
552 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
553 'label_off' => esc_html__( 'No', 'easy-elements' ),
554 'default' => 'yes',
555 'condition' => [
556 'show_meta' => 'comments',
557 ]
558 ]
559 );
560
561 $this->add_control(
562 'comments_icon',
563 [
564 'label' => esc_html__( 'Comments Icon', 'easy-elements' ),
565 'type' => \Elementor\Controls_Manager::ICONS,
566 'condition' => [
567 'show_comments_icon' => 'yes',
568 'show_meta' => 'comments',
569 ],
570 ]
571 );
572
573 $this->add_control(
574 'show_read_time_icon',
575 [
576 'label' => esc_html__('Show Reading Time Icon', 'easy-elements'),
577 'type' => \Elementor\Controls_Manager::SWITCHER,
578 'default' => 'yes',
579 ]
580 );
581
582 $this->add_control(
583 'read_time_icon',
584 [
585 'label' => esc_html__('Reading Time Icon', 'easy-elements'),
586 'type' => \Elementor\Controls_Manager::ICONS,
587 'condition' => [
588 'show_read_time_icon' => 'yes',
589 ],
590 ]
591 );
592
593
594 $this->add_responsive_control(
595 'meta_icon_offset',
596 [
597 'label' => esc_html__( 'Meta Icon Offset (px)', 'easy-elements' ),
598 'type' => \Elementor\Controls_Manager::SLIDER,
599 'size_units' => [ 'px' ],
600 'range' => [
601 'px' => [
602 'min' => -50,
603 'max' => 100,
604 ],
605 ],
606 'selectors' => [
607 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta svg, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta i' => 'top: {{SIZE}}{{UNIT}};',
608 ],
609 ]
610 );
611
612 $this->add_control(
613 'meta_position',
614 [
615 'label' => esc_html__( 'Meta Position', 'easy-elements' ),
616 'type' => \Elementor\Controls_Manager::SELECT,
617 'default' => $is_pro ? 'up_title' : '',
618 'options' => $is_pro
619 ? [
620 'up_title' => esc_html__( 'Up Title', 'easy-elements' ),
621 'below_title' => esc_html__( 'Below Title', 'easy-elements' ),
622 'below_content'=> esc_html__( 'Below Content', 'easy-elements' ),
623 ]
624 : [ '' => esc_html__( 'Available in Pro version', 'easy-elements' ) ],
625 'description' => $is_pro ? '' : esc_html__( 'This option is available in Pro version.', 'easy-elements' ),
626 'disabled' => ! $is_pro,
627 ]
628 );
629
630
631 $this->add_control(
632 'eel_separator',
633 [
634 'label' => esc_html__( 'Separator Type', 'easy-elements' ),
635 'type' => \Elementor\Controls_Manager::SELECT,
636 'options' => [
637 '' => esc_html__( 'None', 'easy-elements' ),
638 'line' => esc_html__( 'Line', 'easy-elements' ),
639 'circle' => esc_html__( 'Circle', 'easy-elements' ),
640 ],
641 'default' => '',
642 ]
643 );
644
645 $this->add_control(
646 'separator_color',
647 [
648 'label' => __( 'Separator Color', 'easy-elements' ),
649 'type' => \Elementor\Controls_Manager::COLOR,
650 'selectors' => [
651 '{{WRAPPER}} .eel--separator--line li + li::before, {{WRAPPER}} .eel--separator--circle li + li::before' => 'background-color: {{VALUE}};',
652 ],
653 'condition' => [
654 'eel_separator!' => '',
655 ],
656 ]
657 );
658
659 $this->add_responsive_control(
660 'separator_offset',
661 [
662 'label' => esc_html__( 'Separator Offset (px)', 'easy-elements' ),
663 'type' => \Elementor\Controls_Manager::SLIDER,
664 'size_units' => [ 'px' ],
665 'range' => [
666 'px' => [
667 'min' => -50,
668 'max' => 100,
669 ],
670 ],
671 'selectors' => [
672 '{{WRAPPER}} .eel--separator--line li + li::before, {{WRAPPER}} .eel--separator--circle li + li::before' => 'top: {{SIZE}}{{UNIT}};',
673 ],
674 'condition' => [
675 'eel_separator!' => '',
676 ],
677 ]
678 );
679
680
681 $this->add_responsive_control(
682 'meta_margin',
683 [
684 'label' => __( 'Margin', 'easy-elements' ),
685 'type' => \Elementor\Controls_Manager::DIMENSIONS,
686 'size_units' => [ 'px', 'em', '%' ],
687 'selectors' => [
688 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
689 ],
690 ]
691 );
692
693 $this->end_controls_section();
694
695 $this->start_controls_section(
696 '_section_button',
697 [
698 'label' => esc_html__( 'Button Settings', 'easy-elements' ),
699 'tab' => Controls_Manager::TAB_CONTENT,
700 ]
701 );
702
703 $this->add_control(
704 'show_read_more',
705 [
706 'label' => esc_html__( 'Show Read More', 'easy-elements' ),
707 'type' => \Elementor\Controls_Manager::SWITCHER,
708 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
709 'label_off' => esc_html__( 'No', 'easy-elements' ),
710 'return_value' => 'yes',
711 'default' => 'yes',
712 ]
713 );
714
715 $this->add_control(
716 'read_more_text',
717 [
718 'label' => esc_html__( 'Read More', 'easy-elements' ),
719 'type' => \Elementor\Controls_Manager::TEXT,
720 'default' => esc_html__( 'Read More', 'easy-elements' ),
721 'condition' => [
722 'show_read_more' => 'yes',
723 ],
724 ]
725 );
726
727 $this->add_control(
728 'read_more_icon',
729 [
730 'label' => esc_html__( 'Read More Icon', 'easy-elements' ),
731 'type' => \Elementor\Controls_Manager::ICONS,
732 'default' => [
733 'value' => '',
734 'library' => 'fa-solid',
735 ],
736 'condition' => [
737 'show_read_more' => 'yes',
738 ],
739 ]
740 );
741
742 $this->add_control(
743 'read_more_icon_position',
744 [
745 'label' => esc_html__( 'Icon Position', 'easy-elements' ),
746 'type' => \Elementor\Controls_Manager::SELECT,
747 'default' => 'after',
748 'options' => [
749 'before' => esc_html__( 'Before Text', 'easy-elements' ),
750 'after' => esc_html__( 'After Text', 'easy-elements' ),
751 ],
752 'condition' => [
753 'show_read_more' => 'yes',
754 ],
755 ]
756 );
757
758 $this->start_controls_tabs( 'read_more_button_style_tabs' );
759
760 // Normal State
761 $this->start_controls_tab(
762 'button_style_normal',
763 [
764 'label' => esc_html__( 'Normal', 'easy-elements' ),
765 ]
766 );
767
768 $this->add_control(
769 'button_text_color',
770 [
771 'label' => esc_html__( 'Color', 'easy-elements' ),
772 'type' => \Elementor\Controls_Manager::COLOR,
773 'selectors' => [
774 '{{WRAPPER}} .eel--read-more a' => 'color: {{VALUE}};',
775 ],
776 ]
777 );
778
779 $this->add_group_control(
780 \Elementor\Group_Control_Typography::get_type(),
781 [
782 'name' => 'button_typography',
783 'selector' => '{{WRAPPER}} .eel--read-more a',
784 ]
785 );
786
787 $this->add_group_control(
788 \Elementor\Group_Control_Background::get_type(),
789 [
790 'name' => 'eel_btn_background',
791 'label' => __( 'Button Background', 'easy-elements' ),
792 'types' => [ 'classic', 'gradient' ],
793 'selector' => '{{WRAPPER}} .eel--read-more a',
794 ]
795 );
796
797 $this->add_group_control(
798 \Elementor\Group_Control_Border::get_type(),
799 [
800 'name' => 'button_border',
801 'selector' => '{{WRAPPER}} .eel--read-more a',
802 ]
803 );
804
805 $this->add_responsive_control(
806 'button_border_radius',
807 [
808 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
809 'type' => \Elementor\Controls_Manager::DIMENSIONS,
810 'size_units' => [ 'px', '%' ],
811 'selectors' => [
812 '{{WRAPPER}} .eel--read-more a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
813 ],
814 ]
815 );
816
817 $this->add_responsive_control(
818 'button_padding',
819 [
820 'label' => esc_html__( 'Padding', 'easy-elements' ),
821 'type' => \Elementor\Controls_Manager::DIMENSIONS,
822 'size_units' => [ 'px', 'em', '%' ],
823 'selectors' => [
824 '{{WRAPPER}} .eel--read-more a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
825 ],
826 ]
827 );
828
829 $this->add_responsive_control(
830 'button_margin',
831 [
832 'label' => esc_html__( 'Margin', 'easy-elements' ),
833 'type' => \Elementor\Controls_Manager::DIMENSIONS,
834 'size_units' => [ 'px', 'em', '%' ],
835 'selectors' => [
836 '{{WRAPPER}} .eel--read-more' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
837 ],
838 ]
839 );
840
841 $this->end_controls_tab();
842
843 $this->start_controls_tab(
844 'button_style_hover',
845 [
846 'label' => esc_html__( 'Hover', 'easy-elements' ),
847 ]
848 );
849
850 $this->add_control(
851 'button_text_color_hover',
852 [
853 'label' => esc_html__( 'Color', 'easy-elements' ),
854 'type' => \Elementor\Controls_Manager::COLOR,
855 'selectors' => [
856 '{{WRAPPER}} .eel--read-more a:hover' => 'color: {{VALUE}};',
857 ],
858 ]
859 );
860
861 $this->add_control(
862 'button_bg_color_hover',
863 [
864 'label' => esc_html__( 'Background Color', 'easy-elements' ),
865 'type' => \Elementor\Controls_Manager::COLOR,
866 'selectors' => [
867 '{{WRAPPER}} .eel--read-more a:hover' => 'background-color: {{VALUE}};',
868 ],
869 ]
870 );
871
872 $this->add_group_control(
873 \Elementor\Group_Control_Border::get_type(),
874 [
875 'name' => 'button_border_hover',
876 'selector' => '{{WRAPPER}} .eel--read-more a:hover',
877 ]
878 );
879
880 $this->end_controls_tab();
881
882 $this->end_controls_tabs();
883
884 $this->add_responsive_control(
885 'btn_icon_offset',
886 [
887 'label' => esc_html__( 'Icon Offset (Vertical)', 'easy-elements' ),
888 'type' => \Elementor\Controls_Manager::SLIDER,
889 'size_units' => [ 'px' ],
890 'range' => [
891 'px' => [
892 'min' => -50,
893 'max' => 100,
894 ],
895 ],
896 'selectors' => [
897 '{{WRAPPER}} .eel--read-more-icon.after' => 'top: {{SIZE}}{{UNIT}};',
898 ],
899 'condition' => [
900 'show_read_more' => 'yes',
901 ],
902 ]
903 );
904
905 $this->add_responsive_control(
906 'btn_icon_offset_ho',
907 [
908 'label' => esc_html__( 'Icon Offset (Horizontal)', 'easy-elements' ),
909 'type' => \Elementor\Controls_Manager::SLIDER,
910 'size_units' => [ 'px' ],
911 'range' => [
912 'px' => [
913 'min' => -50,
914 'max' => 100,
915 ],
916 ],
917 'selectors' => [
918 '{{WRAPPER}} .eel--read-more-icon.after' => 'left: {{SIZE}}{{UNIT}};',
919 ],
920 'condition' => [
921 'show_read_more' => 'yes',
922 ],
923 ]
924 );
925
926 $this->end_controls_section();
927
928 $this->start_controls_section(
929 '_section_button_icon',
930 [
931 'label' => esc_html__( 'Only Icon Button Settings', 'easy-elements' ),
932 'tab' => Controls_Manager::TAB_CONTENT,
933 ]
934 );
935
936 $this->add_control(
937 'only_icon_show',
938 [
939 'label' => esc_html__( 'Show Icon', 'easy-elements' ),
940 'type' => \Elementor\Controls_Manager::SWITCHER,
941 'label_on' => esc_html__( 'Yes', 'easy-elements' ),
942 'label_off' => esc_html__( 'No', 'easy-elements' ),
943 'return_value' => 'yes',
944 'default' => '',
945 ]
946 );
947
948 if ( $is_pro ) {
949 $this->add_control(
950 'only_icon',
951 [
952 'label' => esc_html__( 'Icon', 'easy-elements' ),
953 'type' => \Elementor\Controls_Manager::ICONS,
954 'default' => [
955 'value' => '',
956 'library' => 'fa-solid',
957 ],
958 ]
959 );
960 } else {
961 $this->add_control(
962 'only_icon_message',
963 [
964 'type' => \Elementor\Controls_Manager::RAW_HTML,
965 'raw' => '<div style="padding:10px; color: #d94a4a; font-weight:bold;">' . esc_html__( 'This option is available in the Pro version only.', 'easy-elements' ) . '</div>',
966 ]
967 );
968 }
969
970 $this->start_controls_tabs( 'button_style_tabs' );
971
972 $this->start_controls_tab(
973 'icon_btn_style_normal',
974 [
975 'label' => __( 'Normal', 'easy-elements' ),
976 ]
977 );
978
979 $this->add_control(
980 'icon_color',
981 [
982 'label' => __( 'Color', 'easy-elements' ),
983 'type' => \Elementor\Controls_Manager::COLOR,
984 'selectors' => [
985 '{{WRAPPER}} .eel--button-icon svg, {{WRAPPER}} .eel--button-icon i' => 'color: {{VALUE}}; fill: {{VALUE}};',
986 ],
987 ]
988 );
989
990 $this->add_group_control(
991 \Elementor\Group_Control_Background::get_type(),
992 [
993 'name' => 'eel_iocn_background',
994 'label' => __( 'Button Background', 'easy-elements' ),
995 'types' => [ 'classic', 'gradient' ],
996 'selector' => '{{WRAPPER}} .eel--button-icon',
997 ]
998 );
999
1000 $this->add_group_control(
1001 \Elementor\Group_Control_Border::get_type(),
1002 [
1003 'name' => 'icon_btn_border',
1004 'label' => __( 'Button Border', 'easy-elements' ),
1005 'selector' => '{{WRAPPER}} .eel--button-icon',
1006 ]
1007 );
1008
1009 $this->add_control(
1010 'icon_border_radius',
1011 [
1012 'label' => __( 'Border Radius', 'easy-elements' ),
1013 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1014 'size_units' => [ 'px', '%' ],
1015 'selectors' => [
1016 '{{WRAPPER}} .eel--button-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1017 ],
1018 ]
1019 );
1020
1021 $this->end_controls_tab();
1022
1023 $this->start_controls_tab(
1024 'icon_btn_style_hover',
1025 [
1026 'label' => __( 'Hover', 'easy-elements' ),
1027 ]
1028 );
1029
1030 $this->add_control(
1031 'icon_color_hover',
1032 [
1033 'label' => __( 'Color', 'easy-elements' ),
1034 'type' => \Elementor\Controls_Manager::COLOR,
1035 'selectors' => [
1036 '{{WRAPPER}} .eel--button-icon:hover svg, {{WRAPPER}} .eel--button-icon:hover i' => 'color: {{VALUE}}; fill: {{VALUE}};',
1037 ],
1038 ]
1039 );
1040
1041 $this->add_group_control(
1042 \Elementor\Group_Control_Background::get_type(),
1043 [
1044 'name' => 'eel_iocn_background_hover',
1045 'label' => __( 'Button Background', 'easy-elements' ),
1046 'types' => [ 'classic', 'gradient' ],
1047 'selector' => '{{WRAPPER}} .eel--button-icon:hover',
1048 ]
1049 );
1050
1051 $this->end_controls_tab();
1052 $this->end_controls_tabs();
1053 $this->end_controls_section();
1054
1055
1056 $this->start_controls_section(
1057 'section_pagination_settings',
1058 [
1059 'label' => __( 'Pagination', 'easy-elements' ),
1060 'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
1061 ]
1062 );
1063
1064 $this->add_control(
1065 'show_pagination',
1066 [
1067 'label' => esc_html__( 'Show Pagination', 'easy-elements' ),
1068 'type' => Controls_Manager::SWITCHER,
1069 'label_on' => esc_html__( 'Show', 'easy-elements' ),
1070 'label_off' => esc_html__( 'Hide', 'easy-elements' ),
1071 'return_value' => 'yes',
1072 'default' => 'yes',
1073 ]
1074 );
1075
1076 $this->start_controls_tabs( 'pagination__tabs' );
1077
1078 $this->start_controls_tab(
1079 'pagination__normal',
1080 [
1081 'label' => __( 'Normal', 'easy-elements' ),
1082 ]
1083 );
1084
1085 $this->add_control(
1086 'pagination_color',
1087 [
1088 'label' => esc_html__( 'Color', 'easy-elements' ),
1089 'type' => \Elementor\Controls_Manager::COLOR,
1090 'selectors' => [
1091 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'color: {{VALUE}};',
1092 ],
1093 ]
1094 );
1095
1096 $this->add_group_control(
1097 \Elementor\Group_Control_Background::get_type(),
1098 [
1099 'name' => 'pagination_background',
1100 'types' => [ 'classic', 'gradient' ],
1101 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1102 ]
1103 );
1104
1105 $this->add_group_control(
1106 \Elementor\Group_Control_Typography::get_type(),
1107 [
1108 'name' => 'pagination_typography',
1109 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1110 ]
1111 );
1112
1113 $this->add_group_control(
1114 \Elementor\Group_Control_Border::get_type(),
1115 [
1116 'name' => 'pagination_border',
1117 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a',
1118 ]
1119 );
1120
1121 $this->add_responsive_control(
1122 'pagination_border_radius',
1123 [
1124 'label' => esc_html__( 'Border Radius', 'easy-elements' ),
1125 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1126 'size_units' => [ 'px', '%' ],
1127 'selectors' => [
1128 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1129 ],
1130 ]
1131 );
1132
1133 $this->add_responsive_control(
1134 'pagination_width',
1135 [
1136 'label' => esc_html__( 'Width', 'easy-elements' ),
1137 'type' => \Elementor\Controls_Manager::SLIDER,
1138 'size_units' => [ 'px' ],
1139 'range' => [
1140 'px' => [
1141 'min' => 40,
1142 'max' => 100,
1143 ],
1144 ],
1145 'selectors' => [
1146 '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};',
1147 ],
1148 'condition' => [
1149 'show_pagination' => 'yes',
1150 ],
1151 ]
1152 );
1153
1154 $this->add_group_control(
1155 \Elementor\Group_Control_Box_Shadow::get_type(),
1156 [
1157 'name' => 'pagination_box_shadow',
1158 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li a, {{WRAPPER}} .eel-blog-pagination ul li span',
1159 ]
1160 );
1161
1162 $this->add_control(
1163 'pagination_alignment',
1164 [
1165 'label' => __( 'Alignment', 'easy-elements' ),
1166 'type' => \Elementor\Controls_Manager::CHOOSE,
1167 'options' => [
1168 'left' => [
1169 'title' => __( 'Left', 'easy-elements' ),
1170 'icon' => 'eicon-text-align-left',
1171 ],
1172 'center' => [
1173 'title' => __( 'Center', 'easy-elements' ),
1174 'icon' => 'eicon-text-align-center',
1175 ],
1176 'right' => [
1177 'title' => __( 'Right', 'easy-elements' ),
1178 'icon' => 'eicon-text-align-right',
1179 ],
1180 ],
1181 'default' => 'center',
1182 'toggle' => true,
1183 'selectors' => [
1184 '{{WRAPPER}} .eel-blog-pagination' => 'text-align: {{VALUE}};',
1185 ],
1186 ]
1187 );
1188
1189 $this->end_controls_tab();
1190
1191 $this->start_controls_tab(
1192 'pagination__hover',
1193 [
1194 'label' => __( 'Hover', 'easy-elements' ),
1195 ]
1196 );
1197
1198 $this->add_control(
1199 'pagination_color_current',
1200 [
1201 'label' => esc_html__( 'Color', 'easy-elements' ),
1202 'type' => \Elementor\Controls_Manager::COLOR,
1203 'selectors' => [
1204 '{{WRAPPER}} .eel-blog-pagination ul li a:hover, {{WRAPPER}} .eel-blog-pagination ul li span.current' => 'color: {{VALUE}};',
1205 ],
1206 ]
1207 );
1208
1209 $this->add_group_control(
1210 \Elementor\Group_Control_Background::get_type(),
1211 [
1212 'name' => 'pagination_background_current',
1213 'types' => [ 'classic', 'gradient' ],
1214 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li span.current, {{WRAPPER}} .eel-blog-pagination ul li a:hover',
1215 ]
1216 );
1217
1218 $this->add_group_control(
1219 \Elementor\Group_Control_Border::get_type(),
1220 [
1221 'name' => 'pagination_border_hover',
1222 'selector' => '{{WRAPPER}} .eel-blog-pagination ul li span.current, {{WRAPPER}} .eel-blog-pagination ul li a:hover',
1223 ]
1224 );
1225
1226 $this->end_controls_tab();
1227 $this->end_controls_tabs();
1228 $this->end_controls_section();
1229
1230
1231 $this->start_controls_section(
1232 'section_item_style',
1233 [
1234 'label' => __( 'Items', 'easy-elements' ),
1235 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1236 ]
1237 );
1238
1239 $this->add_group_control(
1240 \Elementor\Group_Control_Background::get_type(),
1241 [
1242 'name' => 'item_background',
1243 'label' => __( 'Item Background', 'easy-elements' ),
1244 'types' => [ 'classic', 'gradient' ],
1245 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner',
1246 ]
1247 );
1248
1249 $this->add_responsive_control(
1250 'item_padding',
1251 [
1252 'label' => __( 'Padding', 'easy-elements' ),
1253 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1254 'size_units' => [ 'px', 'em', '%' ],
1255 'selectors' => [
1256 '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1257 ],
1258 ]
1259 );
1260
1261 $this->add_responsive_control(
1262 'item_border_radius',
1263 [
1264 'label' => __( 'Border Radius', 'easy-elements' ),
1265 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1266 'size_units' => [ 'px', '%' ],
1267 'selectors' => [
1268 '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1269 ],
1270 ]
1271 );
1272
1273 $this->add_group_control(
1274 \Elementor\Group_Control_Border::get_type(),
1275 [
1276 'name' => 'item_border',
1277 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .grid-item-inner',
1278 ]
1279 );
1280
1281 $this->end_controls_section();
1282
1283 $this->start_controls_section(
1284 'section_conten_style',
1285 [
1286 'label' => __( 'Content Part', 'easy-elements' ),
1287 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1288 ]
1289 );
1290
1291 $this->add_group_control(
1292 \Elementor\Group_Control_Background::get_type(),
1293 [
1294 'name' => 'content_background',
1295 'label' => __( 'Item Background', 'easy-elements' ),
1296 'types' => [ 'classic', 'gradient' ],
1297 'selector' => '{{WRAPPER}} .ee--blog-content-wrap',
1298 ]
1299 );
1300
1301 $this->add_responsive_control(
1302 'content_padding',
1303 [
1304 'label' => __( 'Padding', 'easy-elements' ),
1305 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1306 'size_units' => [ 'px', 'em', '%' ],
1307 'selectors' => [
1308 '{{WRAPPER}} .ee--blog-content-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1309 ],
1310 ]
1311 );
1312
1313 $this->add_responsive_control(
1314 'content_border_radius',
1315 [
1316 'label' => __( 'Border Radius', 'easy-elements' ),
1317 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1318 'size_units' => [ 'px', '%' ],
1319 'selectors' => [
1320 '{{WRAPPER}} .ee--blog-content-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1321 ],
1322 ]
1323 );
1324
1325 $this->end_controls_section();
1326
1327 $this->start_controls_section(
1328 'section_title_style',
1329 [
1330 'label' => __( 'Title', 'easy-elements' ),
1331 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1332 ]
1333 );
1334
1335 // Typography
1336 $this->add_group_control(
1337 \Elementor\Group_Control_Typography::get_type(),
1338 [
1339 'name' => 'title_typography',
1340 'selector' => '{{WRAPPER}} .ee--blog-title',
1341 ]
1342 );
1343
1344 // Tabs for Normal and Hover state
1345 $this->start_controls_tabs( 'title_color_tabs' );
1346
1347 // Normal
1348 $this->start_controls_tab(
1349 'title_color_normal',
1350 [
1351 'label' => esc_html__( 'Normal', 'easy-elements' ),
1352 ]
1353 );
1354 $this->add_control(
1355 'title_color',
1356 [
1357 'label' => esc_html__( 'Color', 'easy-elements' ),
1358 'type' => \Elementor\Controls_Manager::COLOR,
1359 'selectors' => [
1360 '{{WRAPPER}} .ee--blog-title' => 'color: {{VALUE}};',
1361 ],
1362 ]
1363 );
1364
1365
1366 $this->add_responsive_control(
1367 'title_margin',
1368 [
1369 'label' => __( 'Margin', 'easy-elements' ),
1370 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1371 'size_units' => [ 'px', 'em', '%' ],
1372 'selectors' => [
1373 '{{WRAPPER}} .ee--blog-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1374 ],
1375 ]
1376 );
1377
1378 $this->end_controls_tab();
1379
1380 // Hover
1381 $this->start_controls_tab(
1382 'title_color_hover',
1383 [
1384 'label' => esc_html__( 'Hover', 'easy-elements' ),
1385 ]
1386 );
1387 $this->add_control(
1388 'title_hover_color',
1389 [
1390 'label' => esc_html__( 'Hover Color', 'easy-elements' ),
1391 'type' => \Elementor\Controls_Manager::COLOR,
1392 'selectors' => [
1393 '{{WRAPPER}} .ee--blog-title:hover a' => 'color: {{VALUE}};',
1394 ],
1395 ]
1396 );
1397 $this->end_controls_tab();
1398
1399 $this->end_controls_tabs();
1400
1401 $this->end_controls_section();
1402
1403
1404 $this->start_controls_section(
1405 'section_excerpt_style',
1406 [
1407 'label' => __( 'Excerpt', 'easy-elements' ),
1408 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1409 ]
1410 );
1411
1412 $this->add_control(
1413 'excerpt_color',
1414 [
1415 'label' => esc_html__( 'Color', 'easy-elements' ),
1416 'type' => \Elementor\Controls_Manager::COLOR,
1417 'selectors' => [
1418 '{{WRAPPER}} .eel--blog-excerpt' => 'color: {{VALUE}};',
1419 ],
1420 ]
1421 );
1422
1423 $this->add_group_control(
1424 \Elementor\Group_Control_Typography::get_type(),
1425 [
1426 'name' => 'excerpt_typography',
1427 'selector' => '{{WRAPPER}} .eel--blog-excerpt',
1428 ]
1429 );
1430
1431 $this->add_responsive_control(
1432 'excerpt_margin',
1433 [
1434 'label' => __( 'Margin', 'easy-elements' ),
1435 'type' => \Elementor\Controls_Manager::DIMENSIONS,
1436 'size_units' => [ 'px', 'em', '%' ],
1437 'selectors' => [
1438 '{{WRAPPER}} .eel--blog-excerpt' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1439 ],
1440 ]
1441 );
1442
1443 $this->end_controls_section();
1444
1445
1446 $this->start_controls_section(
1447 'section_meta_style',
1448 [
1449 'label' => __( 'Meta', 'easy-elements' ),
1450 'tab' => \Elementor\Controls_Manager::TAB_STYLE,
1451 ]
1452 );
1453
1454 $this->add_control(
1455 'meta_text_color',
1456 [
1457 'label' => __( 'Color', 'easy-elements' ),
1458 'type' => \Elementor\Controls_Manager::COLOR,
1459 'selectors' => [
1460 '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li, {{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li *' => 'color: {{VALUE}};',
1461 ],
1462 ]
1463 );
1464
1465 $this->add_group_control(
1466 \Elementor\Group_Control_Typography::get_type(),
1467 [
1468 'name' => 'meta_typography',
1469 'label' => __( 'Typography', 'easy-elements' ),
1470 'selector' => '{{WRAPPER}} .eel-post-grid-wrap .eel--blog-meta li',
1471 ]
1472 );
1473
1474 $this->add_responsive_control(
1475 'meta_spacing',
1476 [
1477 'label' => esc_html__( 'Meta Spacing', 'easy-elements' ),
1478 'type' => \Elementor\Controls_Manager::SLIDER,
1479 'size_units' => [ 'px' ],
1480 'range' => [
1481 'px' => [
1482 'min' => 0,
1483 'max' => 100,
1484 ],
1485 ],
1486 'selectors' => [
1487 '{{WRAPPER}} .eel--blog-meta li+li' => 'margin-left: {{SIZE}}{{UNIT}}; padding-left: {{SIZE}}{{UNIT}};',
1488 ],
1489 ]
1490 );
1491
1492
1493 $this->end_controls_section();
1494 }
1495
1496 protected function render_blog_meta( $settings ) {
1497 if ( empty( $settings['show_meta'] ) || ! is_array( $settings['show_meta'] ) ) {
1498 return;
1499 }
1500
1501 $show_meta = $settings['show_meta'];
1502 $eel_separator = ! empty( $settings['eel_separator'] ) ? 'eel--separator--' . esc_attr( $settings['eel_separator'] ) : '';
1503 ?>
1504 <ul class="eel--blog-meta <?php echo esc_attr($eel_separator); ?>">
1505 <?php if ( in_array( 'date', $show_meta ) ) : ?>
1506 <li class="eel--blog-date">
1507 <?php
1508 if ( ! empty($settings['show_date_icon']) && $settings['show_date_icon'] === 'yes' ) {
1509 if ( empty( $settings['date_icon']['value'] ) ) {
1510 echo '<i class="unicon-calendar"></i>';
1511 } else {
1512 \Elementor\Icons_Manager::render_icon( $settings['date_icon'], [ 'aria-hidden' => 'true' ] );
1513 }
1514 }
1515 echo esc_html( get_the_date() );
1516 ?>
1517 </li>
1518 <?php endif; ?>
1519
1520 <?php if ( in_array( 'author', $show_meta ) ) : ?>
1521 <li class="eel--blog-author">
1522 <?php
1523 if ( ! empty($settings['show_author_icon']) && $settings['show_author_icon'] === 'yes' ) {
1524 if ( empty( $settings['author_icon']['value'] ) ) {
1525 echo '<i class="unicon-user"></i>';
1526 } else {
1527 \Elementor\Icons_Manager::render_icon( $settings['author_icon'], [ 'aria-hidden' => 'true' ] );
1528 }
1529 }
1530
1531 if ( ! empty($settings['show_by_label']) && $settings['show_by_label'] === 'yes' ) {
1532 echo '<em class="eel--meta-by">' . esc_html__( 'By', 'easy-elements' ) . '</em> ';
1533 }
1534
1535 $author_id = get_the_author_meta( 'ID' );
1536 $author_name = get_the_author();
1537 $author_url = get_author_posts_url( $author_id );
1538
1539 if ( ! empty($settings['author_link_enable']) && $settings['author_link_enable'] === 'yes' ) {
1540 echo '<a class="eel--meta-author" href="' . esc_url( $author_url ) . '">' . esc_html( $author_name ) . '</a>';
1541 } else {
1542 echo '<span class="eel--meta-author">' . esc_html( $author_name ) . '</span>';
1543 }
1544 ?>
1545 </li>
1546 <?php endif; ?>
1547
1548 <?php if ( in_array( 'category', $show_meta ) ) : ?>
1549 <li class="eel--blog-cat">
1550 <?php
1551 if ( ! empty($settings['show_category_icon']) && $settings['show_category_icon'] === 'yes' ) {
1552 if ( empty( $settings['category_icon']['value'] ) ) {
1553 echo '<i class="unicon-folder"></i>';
1554 } else {
1555 \Elementor\Icons_Manager::render_icon( $settings['category_icon'], [ 'aria-hidden' => 'true' ] );
1556 }
1557 }
1558 the_category( ', ' );
1559 ?>
1560 </li>
1561 <?php endif; ?>
1562
1563 <?php if ( in_array( 'comments', $show_meta ) ) : ?>
1564 <li class="eel--blog-comments">
1565 <?php
1566 if ( ! empty($settings['show_comments_icon']) && $settings['show_comments_icon'] === 'yes' ) {
1567 if ( empty( $settings['comments_icon']['value'] ) ) {
1568 echo '<i class="unicon-forum"></i>';
1569 } else {
1570 \Elementor\Icons_Manager::render_icon( $settings['comments_icon'], [ 'aria-hidden' => 'true' ] );
1571 }
1572 }
1573 $comments_number = get_comments_number();
1574 echo '<a href="' . esc_url( get_comments_link() ) . '">' . esc_html( $comments_number ) . ' ' . esc_html( _n( 'Comment', 'Comments', $comments_number, 'easy-elements' ) ) . '</a>';
1575 ?>
1576 </li>
1577 <?php endif; ?>
1578 <?php if ( in_array( 'read_time', $show_meta ) ) : ?>
1579 <li class="eel--blog-read-time">
1580 <?php
1581 if ( ! empty($settings['show_read_time_icon']) && $settings['show_read_time_icon'] === 'yes' ) {
1582 if ( empty( $settings['read_time_icon']['value'] ) ) {
1583 echo '<i class="unicon-time"></i>';
1584 } else {
1585 \Elementor\Icons_Manager::render_icon( $settings['read_time_icon'], [ 'aria-hidden' => 'true' ] );
1586 }
1587 }
1588 $word_count = str_word_count( wp_strip_all_tags( get_the_content() ) );
1589 $reading_time = ceil( $word_count / 80 );
1590 echo esc_html( $reading_time ) . ' ' . esc_html__( 'mins read', 'easy-elements' );
1591 ?>
1592 </li>
1593 <?php endif; ?>
1594 </ul>
1595 <?php
1596 }
1597
1598 protected function render() {
1599
1600 $settings = $this->get_settings_for_display();
1601 $post_type = $settings['post_type']?? '';
1602 $title_tag = $settings['title_tag'];
1603 $posts_per_page = $settings['posts_per_page'];
1604 $orderby = $settings['orderby'];
1605 $order = $settings['order'];
1606 $offset = $settings['offset'] ?? '';
1607 $thumbnail_size = $settings['thumbnail_size'];
1608 $title_trim = $settings['title_trim'];
1609 $excerpt_trim = $settings['excerpt_trim'];
1610 $post_type = !empty( $settings['post_type'] ) ? $settings['post_type'] : 'post';
1611 $paged = max( 1, get_query_var('paged') ? get_query_var('paged') : ( get_query_var('page') ? get_query_var('page') : 1 ) );
1612
1613 $args = [
1614 'post_type' => $post_type,
1615 'posts_per_page' => $settings['posts_per_page'],
1616 'orderby' => ! empty( $orderby ) ? $orderby : 'date',
1617 'order' => ! empty( $order ) ? $order : 'DESC',
1618 'offset' => $offset,
1619 ];
1620
1621 if ( $settings['source_type'] === 'category' && ! empty( $settings['categories'] ) ) {
1622 $args['category__in'] = $settings['categories'];
1623 } elseif ( $settings['source_type'] === 'post' && ! empty( $settings['post__in'] ) ) {
1624 $args['post__in'] = $settings['post__in'];
1625 $args['orderby'] = 'post__in'; // Preserve selected order
1626 }
1627
1628 if ( is_archive() || is_home() || is_search() ) {
1629 global $wp_query;
1630 $query = $wp_query;
1631 } else {
1632 $query = new \WP_Query( $args );
1633 }
1634
1635 if ( ! empty( $settings['exclude_posts'] ) && $query->have_posts() ) {
1636 $exclude_ids = (array) $settings['exclude_posts'];
1637
1638 $query->posts = array_filter( $query->posts, function( $post ) use ( $exclude_ids ) {
1639 return ! in_array( $post->ID, $exclude_ids, true );
1640 });
1641
1642 $query->post_count = count( $query->posts );
1643 }
1644
1645
1646 if ( $query->have_posts() ) :
1647 echo '<div class="eel-post-grid-wrap">';
1648 while ( $query->have_posts() ) : $query->the_post();
1649
1650 $trimmed_title = wp_trim_words( get_the_title(), $title_trim, '...' );
1651 $trimmed_excerpt = wp_trim_words( get_the_excerpt(), $excerpt_trim, '...' );
1652 ?>
1653 <div class="grid-item">
1654 <div class="grid-item-inner">
1655 <?php if ( 'yes' === $settings['show_thumbnail'] ) { ?>
1656 <div class="eel--blog-img">
1657 <a href="<?php the_permalink(); ?>">
1658 <?php
1659 if ( has_post_thumbnail() ) {
1660 $alt = esc_attr( get_the_title() );
1661 the_post_thumbnail( $thumbnail_size, array( 'alt' => $alt ) );
1662 }
1663 ?>
1664 </a>
1665 </div>
1666 <?php } ?>
1667 <div class="ee--blog-content-wrap">
1668 <div class="ee--blog-content">
1669 <?php if ( 'up_title' === $settings['meta_position'] ) : ?>
1670 <?php $this->render_blog_meta( $settings ); ?>
1671 <?php endif; ?>
1672
1673 <<?php echo esc_attr( $title_tag ); ?> class="ee--blog-title">
1674 <a href="<?php the_permalink(); ?>"><?php echo esc_html( $trimmed_title ); ?></a>
1675 </<?php echo esc_attr( $title_tag ); ?>>
1676
1677 <?php if ( 'below_title' === $settings['meta_position'] ) : ?>
1678 <?php $this->render_blog_meta( $settings ); ?>
1679 <?php endif; ?>
1680 <?php if ( $settings['show_excerpt'] === 'yes' ) : ?>
1681 <div class="eel--blog-excerpt">
1682 <?php echo esc_html( $trimmed_excerpt ); ?>
1683 </div>
1684 <?php endif; ?>
1685 <?php if ( 'below_content' === $settings['meta_position'] ) : ?>
1686 <?php $this->render_blog_meta( $settings ); ?>
1687 <?php endif; ?>
1688 </div>
1689
1690 <?php if ( ! empty( $settings['read_more_text'] ) ) : ?>
1691 <div class="eel--read-more">
1692 <a href="<?php the_permalink(); ?>" class="eel--read-more-link">
1693 <?php
1694 if ( isset( $settings['read_more_icon'] ) && ! empty( $settings['read_more_icon']['value'] ) && $settings['read_more_icon_position'] === 'before' ) {
1695 \Elementor\Icons_Manager::render_icon( $settings['read_more_icon'], [
1696 'aria-hidden' => 'true',
1697 'class' => 'eel--read-more-icon before'
1698 ] );
1699 } elseif ( $settings['read_more_icon_position'] === 'before' ) {
1700 echo '<i class="unicon-chevron-right eel--read-more-icon before"></i>';
1701 }
1702 ?>
1703
1704 <?php echo esc_html( $settings['read_more_text'] ); ?>
1705
1706 <?php
1707 if ( isset( $settings['read_more_icon'] ) && ! empty( $settings['read_more_icon']['value'] ) && $settings['read_more_icon_position'] === 'after' ) {
1708 \Elementor\Icons_Manager::render_icon( $settings['read_more_icon'], [
1709 'aria-hidden' => 'true',
1710 'class' => 'eel--read-more-icon after'
1711 ] );
1712 } elseif ( $settings['read_more_icon_position'] === 'after' ) {
1713 echo '<i class="unicon-chevron-right eel--read-more-icon after"></i>';
1714 }
1715 ?>
1716 </a>
1717 </div>
1718 <?php endif;
1719 if ( 'yes' === $settings['only_icon_show'] ) { ?>
1720 <div class="eel--button-icon">
1721 <?php
1722 if ( empty( $settings['only_icon']['value'] ) ) {
1723 echo '<i class="unicon-chevron-right"></i>';
1724 } else {
1725 \Elementor\Icons_Manager::render_icon( $settings['only_icon'], [ 'aria-hidden' => 'true' ] );
1726 } ?>
1727 </div>
1728 <?php
1729 }
1730 ?>
1731 </div>
1732 </div>
1733 </div>
1734 <?php
1735 endwhile;
1736
1737 echo '</div>';
1738
1739 if ( $settings['show_pagination'] === 'yes' ) {
1740 $big = 999999999;
1741 $pagination = paginate_links( [
1742 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
1743 'format' => '?paged=%#%',
1744 'current' => $paged,
1745 'total' => $query->max_num_pages,
1746 'prev_text' => '&laquo;',
1747 'next_text' => '&raquo;',
1748 'type' => 'list',
1749 ] );
1750 echo '<nav class="eel-blog-pagination">';
1751 if ( $pagination ) {
1752 echo wp_kses_post( $pagination );
1753 }
1754 echo '</nav>';
1755 }
1756
1757 wp_reset_postdata();
1758
1759 else :
1760 ?>
1761 <div class="eel-no-posts-found">
1762 <p><?php esc_html_e( 'Nothing Found', 'easy-elements' ); ?></p>
1763 <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'easy-elements' ); ?></p>
1764
1765 <div class="eel-search-form">
1766 <form role="search" method="get" class="eel-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
1767 <input type="search" class="eel-search-field" placeholder="<?php esc_attr_e( 'Search...', 'easy-elements' ); ?>" value="<?php echo get_search_query(); ?>" name="s" />
1768 <button type="submit" class="eel-search-submit">
1769 <i class="unicon-search"></i>
1770 </button>
1771 </form>
1772 </div>
1773 </div>
1774 <?php
1775 endif;
1776 }
1777 }
1778