PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.9
Easy Elements for Elementor – Addons & Website Templates v1.3.9
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 / blog-grid / blog-grid.php

blog-grid.php in Easy Elements for Elementor – Addons & Website Templates 1.3.9, at widgets/blog-grid/blog-grid.php

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