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

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