PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.3
Easy Elements for Elementor – Addons & Website Templates v1.3.3
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.3, at widgets/blog-grid/blog-grid.php

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