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

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

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