Adv_Accordion.php
1 year ago
Adv_Tabs.php
1 year ago
Advanced_Data_Table.php
1 year ago
Better_Payment.php
4 years ago
Betterdocs_Category_Box.php
1 year ago
Betterdocs_Category_Grid.php
1 year ago
Betterdocs_Search_Form.php
1 year ago
Business_Reviews.php
1 year ago
Caldera_Forms.php
1 year ago
Career_Page.php
4 years ago
Contact_Form_7.php
1 year ago
Content_Ticker.php
1 year ago
Countdown.php
1 year ago
Creative_Button.php
1 year ago
Cta_Box.php
1 year ago
Data_Table.php
1 year ago
Dual_Color_Header.php
1 year ago
EmbedPress.php
4 years ago
Event_Calendar.php
1 year ago
Facebook_Feed.php
1 year ago
Fancy_Text.php
1 year ago
Feature_List.php
1 year ago
Filterable_Gallery.php
1 year ago
Flip_Box.php
1 year ago
FluentForm.php
1 year ago
Formstack.php
1 year ago
GravityForms.php
1 year ago
Image_Accordion.php
1 year ago
Info_Box.php
1 year ago
Interactive_Circle.php
1 year ago
Login_Register.php
1 year ago
NFT_Gallery.php
1 year ago
NinjaForms.php
1 year ago
Post_Grid.php
1 year ago
Post_Timeline.php
1 year ago
Pricing_Table.php
1 year ago
Product_Grid.php
1 year ago
Progress_Bar.php
1 year ago
SVG_Draw.php
1 year ago
Simple_Menu.php
1 year ago
Sticky_Video.php
1 year ago
Team_Member.php
1 year ago
Testimonial.php
1 year ago
Tooltip.php
1 year ago
Twitter_Feed.php
1 year ago
TypeForm.php
1 year ago
WeForms.php
2 years ago
Woo_Cart.php
1 year ago
Woo_Checkout.php
1 year ago
Woo_Product_Carousel.php
1 year ago
Woo_Product_Compare.php
2 years ago
Woo_Product_Gallery.php
1 year ago
Woo_Product_List.php
1 year ago
WpForms.php
1 year ago
index.php
3 years ago
Post_Grid.php
1163 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Essential_Addons_Elementor\Elements; |
| 4 | |
| 5 | // If this file is called directly, abort. |
| 6 | if (!defined('ABSPATH')) { |
| 7 | exit; |
| 8 | } |
| 9 | |
| 10 | use \Elementor\Plugin; |
| 11 | use \Elementor\Controls_Manager; |
| 12 | use \Elementor\Group_Control_Border; |
| 13 | use \Elementor\Group_Control_Box_Shadow; |
| 14 | use \Elementor\Group_Control_Typography; |
| 15 | use \Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 16 | use \Elementor\Widget_Base; |
| 17 | use Essential_Addons_Elementor\Classes\Helper as HelperClass; |
| 18 | use Essential_Addons_Elementor\Traits\Helper; |
| 19 | |
| 20 | class Post_Grid extends Widget_Base |
| 21 | { |
| 22 | use Helper; |
| 23 | |
| 24 | protected $page_id; |
| 25 | |
| 26 | public function get_name() |
| 27 | { |
| 28 | return 'eael-post-grid'; |
| 29 | } |
| 30 | |
| 31 | public function get_title() |
| 32 | { |
| 33 | return __('Post Grid', 'essential-addons-for-elementor-lite'); |
| 34 | } |
| 35 | |
| 36 | public function get_icon() |
| 37 | { |
| 38 | return 'eaicon-post-grid'; |
| 39 | } |
| 40 | |
| 41 | public function get_categories() |
| 42 | { |
| 43 | return ['essential-addons-elementor']; |
| 44 | } |
| 45 | |
| 46 | public function get_style_depends() |
| 47 | { |
| 48 | return [ |
| 49 | 'font-awesome-5-all', |
| 50 | 'font-awesome-4-shim', |
| 51 | ]; |
| 52 | } |
| 53 | |
| 54 | public function get_keywords() |
| 55 | { |
| 56 | return [ |
| 57 | 'post', |
| 58 | 'posts', |
| 59 | 'grid', |
| 60 | 'ea post grid', |
| 61 | 'ea posts grid', |
| 62 | 'blog post', |
| 63 | 'article', |
| 64 | 'custom posts', |
| 65 | 'masonry', |
| 66 | 'content views', |
| 67 | 'blog view', |
| 68 | 'content marketing', |
| 69 | 'blogger', |
| 70 | 'ea', |
| 71 | 'essential addons', |
| 72 | ]; |
| 73 | } |
| 74 | |
| 75 | public function get_custom_help_url() |
| 76 | { |
| 77 | return 'https://essential-addons.com/elementor/docs/post-grid/'; |
| 78 | } |
| 79 | |
| 80 | protected function register_controls() |
| 81 | { |
| 82 | /** |
| 83 | * Query And Layout Controls! |
| 84 | * @source includes/elementor-helper.php |
| 85 | */ |
| 86 | do_action('eael/controls/query', $this); |
| 87 | do_action('eael/controls/layout', $this); |
| 88 | |
| 89 | /** |
| 90 | * Grid Style Controls! |
| 91 | */ |
| 92 | $this->start_controls_section( |
| 93 | 'section_post_grid_links', |
| 94 | [ |
| 95 | 'label' => __('Links', 'essential-addons-for-elementor-lite'), |
| 96 | 'conditions' => [ |
| 97 | 'relation' => 'or', |
| 98 | 'terms' => [ |
| 99 | [ |
| 100 | 'name' => 'eael_show_image', |
| 101 | 'operator' => '==', |
| 102 | 'value' => 'yes', |
| 103 | ], |
| 104 | [ |
| 105 | 'name' => 'eael_show_title', |
| 106 | 'operator' => '==', |
| 107 | 'value' => 'yes', |
| 108 | ], |
| 109 | [ |
| 110 | 'name' => 'eael_show_read_more_button', |
| 111 | 'operator' => '==', |
| 112 | 'value' => 'yes', |
| 113 | ], |
| 114 | |
| 115 | ], |
| 116 | ], |
| 117 | ] |
| 118 | ); |
| 119 | |
| 120 | $this->add_control( |
| 121 | 'image_link', |
| 122 | [ |
| 123 | 'label' => __('Image', 'essential-addons-for-elementor-lite'), |
| 124 | 'type' => Controls_Manager::HEADING, |
| 125 | 'condition' => [ |
| 126 | 'eael_show_image' => 'yes', |
| 127 | ], |
| 128 | ] |
| 129 | ); |
| 130 | |
| 131 | $this->add_control( |
| 132 | 'image_link_nofollow', |
| 133 | [ |
| 134 | 'label' => __('No Follow', 'essential-addons-for-elementor-lite'), |
| 135 | 'type' => Controls_Manager::SWITCHER, |
| 136 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 137 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 138 | 'return_value' => 'true', |
| 139 | 'condition' => [ |
| 140 | 'eael_show_image' => 'yes', |
| 141 | ], |
| 142 | ] |
| 143 | ); |
| 144 | |
| 145 | $this->add_control( |
| 146 | 'image_link_target_blank', |
| 147 | [ |
| 148 | 'label' => __('Target Blank', 'essential-addons-for-elementor-lite'), |
| 149 | 'type' => Controls_Manager::SWITCHER, |
| 150 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 151 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 152 | 'return_value' => 'true', |
| 153 | 'condition' => [ |
| 154 | 'eael_show_image' => 'yes', |
| 155 | ], |
| 156 | 'separator' => 'after', |
| 157 | ] |
| 158 | ); |
| 159 | |
| 160 | $this->add_control( |
| 161 | 'title_link', |
| 162 | [ |
| 163 | 'label' => __('Title', 'essential-addons-for-elementor-lite'), |
| 164 | 'type' => Controls_Manager::HEADING, |
| 165 | 'condition' => [ |
| 166 | 'eael_show_title' => 'yes', |
| 167 | ], |
| 168 | ] |
| 169 | ); |
| 170 | |
| 171 | $this->add_control( |
| 172 | 'title_link_nofollow', |
| 173 | [ |
| 174 | 'label' => __('No Follow', 'essential-addons-for-elementor-lite'), |
| 175 | 'type' => Controls_Manager::SWITCHER, |
| 176 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 177 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 178 | 'return_value' => 'true', |
| 179 | 'condition' => [ |
| 180 | 'eael_show_title' => 'yes', |
| 181 | ], |
| 182 | ] |
| 183 | ); |
| 184 | |
| 185 | $this->add_control( |
| 186 | 'title_link_target_blank', |
| 187 | [ |
| 188 | 'label' => __('Target Blank', 'essential-addons-for-elementor-lite'), |
| 189 | 'type' => Controls_Manager::SWITCHER, |
| 190 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 191 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 192 | 'return_value' => 'true', |
| 193 | 'condition' => [ |
| 194 | 'eael_show_title' => 'yes', |
| 195 | ], |
| 196 | 'separator' => 'after', |
| 197 | ] |
| 198 | ); |
| 199 | |
| 200 | $this->add_control( |
| 201 | 'read_more_link', |
| 202 | [ |
| 203 | 'label' => __('Read More', 'essential-addons-for-elementor-lite'), |
| 204 | 'type' => Controls_Manager::HEADING, |
| 205 | 'condition' => [ |
| 206 | 'eael_show_read_more_button' => 'yes', |
| 207 | ], |
| 208 | ] |
| 209 | ); |
| 210 | |
| 211 | $this->add_control( |
| 212 | 'read_more_link_nofollow', |
| 213 | [ |
| 214 | 'label' => __('No Follow', 'essential-addons-for-elementor-lite'), |
| 215 | 'type' => Controls_Manager::SWITCHER, |
| 216 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 217 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 218 | 'return_value' => 'true', |
| 219 | 'condition' => [ |
| 220 | 'eael_show_read_more_button' => 'yes', |
| 221 | ], |
| 222 | ] |
| 223 | ); |
| 224 | |
| 225 | $this->add_control( |
| 226 | 'read_more_link_target_blank', |
| 227 | [ |
| 228 | 'label' => __('Target Blank', 'essential-addons-for-elementor-lite'), |
| 229 | 'type' => Controls_Manager::SWITCHER, |
| 230 | 'label_on' => __('Yes', 'essential-addons-for-elementor-lite'), |
| 231 | 'label_off' => __('No', 'essential-addons-for-elementor-lite'), |
| 232 | 'return_value' => 'true', |
| 233 | 'condition' => [ |
| 234 | 'eael_show_read_more_button' => 'yes', |
| 235 | ], |
| 236 | ] |
| 237 | ); |
| 238 | |
| 239 | $this->end_controls_section(); |
| 240 | |
| 241 | /** |
| 242 | * Grid Style Controls! |
| 243 | */ |
| 244 | $this->start_controls_section( |
| 245 | 'eael_section_post_grid_style', |
| 246 | [ |
| 247 | 'label' => __('Post Grid Style', 'essential-addons-for-elementor-lite'), |
| 248 | 'tab' => Controls_Manager::TAB_STYLE, |
| 249 | ] |
| 250 | ); |
| 251 | |
| 252 | $this->add_control( |
| 253 | 'eael_post_grid_style_three_alert', |
| 254 | [ |
| 255 | 'type' => Controls_Manager::RAW_HTML, |
| 256 | 'raw' => __('Make sure to enable <strong>Show Date</strong> option from <strong>Layout Settings</strong>', 'essential-addons-for-elementor-lite'), |
| 257 | 'content_classes' => 'eael-warning', |
| 258 | 'condition' => [ |
| 259 | 'eael_post_grid_preset_style' => ['two', 'three'], |
| 260 | 'eael_show_date' => '', |
| 261 | ], |
| 262 | ] |
| 263 | ); |
| 264 | |
| 265 | $this->add_control( |
| 266 | 'eael_post_grid_bg_color', |
| 267 | [ |
| 268 | 'label' => __('Post Background Color', 'essential-addons-for-elementor-lite'), |
| 269 | 'type' => Controls_Manager::COLOR, |
| 270 | 'default' => '#fff', |
| 271 | 'selectors' => [ |
| 272 | '{{WRAPPER}} .eael-grid-post-holder' => 'background-color: {{VALUE}}', |
| 273 | ], |
| 274 | |
| 275 | ] |
| 276 | ); |
| 277 | |
| 278 | $this->add_responsive_control( |
| 279 | 'eael_post_grid_spacing', |
| 280 | [ |
| 281 | 'label' => esc_html__('Spacing Between Items', 'essential-addons-for-elementor-lite'), |
| 282 | 'type' => Controls_Manager::DIMENSIONS, |
| 283 | 'size_units' => ['px', '%', 'em'], |
| 284 | 'selectors' => [ |
| 285 | '{{WRAPPER}} .eael-grid-post' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 286 | ], |
| 287 | ] |
| 288 | ); |
| 289 | |
| 290 | $this->add_group_control( |
| 291 | Group_Control_Border::get_type(), |
| 292 | [ |
| 293 | 'name' => 'eael_post_grid_border', |
| 294 | 'label' => esc_html__('Border', 'essential-addons-for-elementor-lite'), |
| 295 | 'selector' => '{{WRAPPER}} .eael-grid-post-holder', |
| 296 | ] |
| 297 | ); |
| 298 | |
| 299 | $this->add_control( |
| 300 | 'eael_post_grid_border_radius', |
| 301 | [ |
| 302 | 'label' => esc_html__('Border Radius', 'essential-addons-for-elementor-lite'), |
| 303 | 'type' => Controls_Manager::DIMENSIONS, |
| 304 | 'selectors' => [ |
| 305 | '{{WRAPPER}} .eael-grid-post-holder' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 306 | ], |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->add_group_control( |
| 311 | Group_Control_Box_Shadow::get_type(), |
| 312 | [ |
| 313 | 'name' => 'eael_post_grid_box_shadow', |
| 314 | 'selector' => '{{WRAPPER}} .eael-grid-post-holder', |
| 315 | ] |
| 316 | ); |
| 317 | |
| 318 | $this->end_controls_section(); |
| 319 | |
| 320 | /** |
| 321 | * Thumbnail style |
| 322 | */ |
| 323 | |
| 324 | $this->start_controls_section( |
| 325 | 'eael_section_post_grid_thumbnail_style', |
| 326 | [ |
| 327 | 'label' => __('Thumbnail Style', 'essential-addons-for-elementor-lite'), |
| 328 | 'tab' => Controls_Manager::TAB_STYLE, |
| 329 | ] |
| 330 | ); |
| 331 | |
| 332 | $this->add_control( |
| 333 | 'eael_post_grid_thumbnail_radius', |
| 334 | [ |
| 335 | 'label' => esc_html__('Radius', 'essential-addons-for-elementor-lite'), |
| 336 | 'type' => Controls_Manager::DIMENSIONS, |
| 337 | 'selectors' => [ |
| 338 | '{{WRAPPER}} .eael-post-grid .eael-grid-post .eael-entry-media img, {{WRAPPER}} .eael-grid-post .eael-entry-overlay' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 339 | ], |
| 340 | ] |
| 341 | ); |
| 342 | |
| 343 | $this->end_controls_section(); |
| 344 | |
| 345 | /** |
| 346 | * Style tab: Meta Date style |
| 347 | */ |
| 348 | $this->start_controls_section( |
| 349 | 'section_meta_date_style', |
| 350 | [ |
| 351 | 'label' => __('Meta Date Style', 'essential-addons-for-elementor-lite'), |
| 352 | 'tab' => Controls_Manager::TAB_STYLE, |
| 353 | 'condition' => [ |
| 354 | 'eael_show_meta' => 'yes', |
| 355 | 'eael_post_grid_preset_style' => ['three'], |
| 356 | ], |
| 357 | ] |
| 358 | ); |
| 359 | $this->add_group_control( |
| 360 | \Elementor\Group_Control_Background::get_type(), |
| 361 | [ |
| 362 | 'name' => 'eael_post_grid_meta_date_background', |
| 363 | 'label' => __('Background', 'essential-addons-for-elementor-lite'), |
| 364 | 'types' => ['classic', 'gradient'], |
| 365 | 'selector' => '{{WRAPPER}} .eael-meta-posted-on', |
| 366 | ] |
| 367 | ); |
| 368 | $this->add_control( |
| 369 | 'eael_post_grid_meta_date_color', |
| 370 | [ |
| 371 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 372 | 'type' => Controls_Manager::COLOR, |
| 373 | 'default' => '', |
| 374 | 'selectors' => [ |
| 375 | '{{WRAPPER}} .eael-meta-posted-on' => 'color: {{VALUE}};', |
| 376 | ], |
| 377 | ] |
| 378 | ); |
| 379 | $this->add_group_control( |
| 380 | Group_Control_Typography::get_type(), |
| 381 | [ |
| 382 | 'name' => 'eael_post_grid_meta_date_typography', |
| 383 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 384 | 'global' => [ |
| 385 | 'default' => Global_Typography::TYPOGRAPHY_TEXT |
| 386 | ], |
| 387 | 'selector' => '{{WRAPPER}} .eael-meta-posted-on', |
| 388 | ] |
| 389 | ); |
| 390 | |
| 391 | $this->add_control( |
| 392 | 'eael_post_grid_meta_date_margin', |
| 393 | [ |
| 394 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 395 | 'type' => Controls_Manager::DIMENSIONS, |
| 396 | 'size_units' => ['px', '%', 'em'], |
| 397 | 'selectors' => [ |
| 398 | '{{WRAPPER}} .eael-meta-posted-on' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 399 | ], |
| 400 | ] |
| 401 | ); |
| 402 | $this->add_group_control( |
| 403 | Group_Control_Box_Shadow::get_type(), |
| 404 | [ |
| 405 | 'name' => 'eael_post_grid_meta_date_shadow', |
| 406 | 'label' => __('Shadow', 'essential-addons-for-elementor-lite'), |
| 407 | 'selector' => '{{WRAPPER}} .eael-meta-posted-on', |
| 408 | 'condition' => [ |
| 409 | 'eael_post_grid_preset_style' => ['three'], |
| 410 | ], |
| 411 | ] |
| 412 | ); |
| 413 | $this->end_controls_section(); |
| 414 | |
| 415 | /** |
| 416 | * Style Tab: Meta Date Position |
| 417 | */ |
| 418 | do_action('eael/controls/custom_positioning', |
| 419 | $this, |
| 420 | 'eael_meta_date_position_', |
| 421 | __('Meta Date Position', 'essential-addons-for-elementor-lite'), |
| 422 | '.eael-meta-posted-on', |
| 423 | [ |
| 424 | 'eael_show_meta' => 'yes', |
| 425 | 'eael_post_grid_preset_style' => ['three'], |
| 426 | ] |
| 427 | ); |
| 428 | |
| 429 | /** |
| 430 | * Style tab: Meta Style |
| 431 | */ |
| 432 | $this->start_controls_section( |
| 433 | 'section_meta_style_style', |
| 434 | [ |
| 435 | 'label' => __('Meta Style', 'essential-addons-for-elementor-lite'), |
| 436 | 'tab' => Controls_Manager::TAB_STYLE, |
| 437 | 'condition' => [ |
| 438 | 'eael_post_grid_preset_style!' => 'three', |
| 439 | 'eael_show_meta' => 'yes', |
| 440 | ], |
| 441 | ] |
| 442 | ); |
| 443 | $this->add_control( |
| 444 | 'eael_post_grid_meta_color', |
| 445 | [ |
| 446 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 447 | 'type' => Controls_Manager::COLOR, |
| 448 | 'default' => '', |
| 449 | 'selectors' => [ |
| 450 | '{{WRAPPER}} .eael-entry-meta a' => 'color: {{VALUE}};', |
| 451 | ], |
| 452 | 'condition' => [ |
| 453 | 'eael_show_author_name' => 'yes', |
| 454 | ], |
| 455 | ] |
| 456 | ); |
| 457 | |
| 458 | $this->add_control( |
| 459 | 'eael_post_grid_meta_color_date', |
| 460 | [ |
| 461 | 'label' => __('Date Color', 'essential-addons-for-elementor-lite'), |
| 462 | 'type' => Controls_Manager::COLOR, |
| 463 | 'default' => '', |
| 464 | 'selectors' => [ |
| 465 | '{{WRAPPER}} .eael-entry-meta .eael-posted-on' => 'color: {{VALUE}};', |
| 466 | '{{WRAPPER}} .eael-post-grid-style-two .eael-entry-meta .eael-meta-posted-on' => 'color: {{VALUE}};', |
| 467 | ], |
| 468 | 'condition' => [ |
| 469 | 'eael_show_date' => 'yes', |
| 470 | ], |
| 471 | ] |
| 472 | ); |
| 473 | |
| 474 | $this->add_responsive_control( |
| 475 | 'eael_post_grid_meta_alignment', |
| 476 | [ |
| 477 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 478 | 'type' => Controls_Manager::CHOOSE, |
| 479 | 'options' => [ |
| 480 | 'flex-start' => [ |
| 481 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 482 | 'icon' => 'eicon-text-align-left', |
| 483 | ], |
| 484 | 'center' => [ |
| 485 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 486 | 'icon' => 'eicon-text-align-center', |
| 487 | ], |
| 488 | 'flex-end' => [ |
| 489 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 490 | 'icon' => 'eicon-text-align-right', |
| 491 | ], |
| 492 | ], |
| 493 | 'default' => 'flex-start', |
| 494 | 'selectors' => [ |
| 495 | '{{WRAPPER}} .eael-grid-post .eael-entry-footer' => 'justify-content: {{VALUE}};', |
| 496 | '{{WRAPPER}} .eael-grid-post .eael-entry-header-after' => 'justify-content: {{VALUE}}; align-items: center;', |
| 497 | ], |
| 498 | ] |
| 499 | ); |
| 500 | |
| 501 | $this->add_group_control( |
| 502 | Group_Control_Typography::get_type(), |
| 503 | [ |
| 504 | 'name' => 'eael_post_grid_meta_typography', |
| 505 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 506 | 'global' => [ |
| 507 | 'default' => Global_Typography::TYPOGRAPHY_TEXT |
| 508 | ], |
| 509 | 'selector' => '{{WRAPPER}} .eael-entry-meta > span', |
| 510 | 'condition' => [ |
| 511 | 'meta_position' => 'meta-entry-footer', |
| 512 | ], |
| 513 | ] |
| 514 | ); |
| 515 | $this->add_group_control( |
| 516 | Group_Control_Typography::get_type(), |
| 517 | [ |
| 518 | 'name' => 'eael_post_grid_meta_header_typography', |
| 519 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 520 | 'global' => [ |
| 521 | 'default' => Global_Typography::TYPOGRAPHY_TEXT |
| 522 | ], |
| 523 | 'selector' => '{{WRAPPER}} .eael-entry-meta > span', |
| 524 | 'condition' => [ |
| 525 | 'meta_position' => 'meta-entry-header', |
| 526 | ], |
| 527 | ] |
| 528 | ); |
| 529 | |
| 530 | $this->add_control( |
| 531 | 'eael_post_grid_meta_margin', |
| 532 | [ |
| 533 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 534 | 'type' => Controls_Manager::DIMENSIONS, |
| 535 | 'size_units' => ['px', '%', 'em'], |
| 536 | 'selectors' => [ |
| 537 | '{{WRAPPER}} .eael-entry-header-after' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 538 | ], |
| 539 | 'condition' => [ |
| 540 | 'meta_position' => 'meta-entry-header', |
| 541 | ], |
| 542 | ] |
| 543 | ); |
| 544 | |
| 545 | $this->add_control( |
| 546 | 'eael_post_grid_meta_footer_margin', |
| 547 | [ |
| 548 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 549 | 'type' => Controls_Manager::DIMENSIONS, |
| 550 | 'size_units' => ['px', '%', 'em'], |
| 551 | 'selectors' => [ |
| 552 | '{{WRAPPER}} .eael-entry-footer' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 553 | '{{WRAPPER}} .eael-entry-header-after' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 554 | ], |
| 555 | 'condition' => [ |
| 556 | 'meta_position' => 'meta-entry-footer', |
| 557 | ], |
| 558 | ] |
| 559 | ); |
| 560 | $this->end_controls_section(); |
| 561 | |
| 562 | /** |
| 563 | * Style Tab: Meta Position |
| 564 | */ |
| 565 | do_action('eael/controls/custom_positioning', |
| 566 | $this, |
| 567 | 'eael_meta_footer_', |
| 568 | __('Meta Position', 'essential-addons-for-elementor-lite'), |
| 569 | '.eael-grid-post .eael-entry-footer', |
| 570 | [ |
| 571 | 'eael_show_meta' => 'yes', |
| 572 | 'meta_position' => ['meta-entry-footer'], |
| 573 | 'eael_post_grid_preset_style!' => 'three', |
| 574 | ] |
| 575 | ); |
| 576 | |
| 577 | do_action('eael/controls/custom_positioning', |
| 578 | $this, |
| 579 | 'eael_meta_header_', |
| 580 | __('Meta Position', 'essential-addons-for-elementor-lite'), |
| 581 | '.eael-grid-post .eael-entry-header-after', |
| 582 | [ |
| 583 | 'eael_show_meta' => 'yes', |
| 584 | 'meta_position' => ['meta-entry-header'], |
| 585 | ] |
| 586 | ); |
| 587 | |
| 588 | /** |
| 589 | * Color, Typography & Spacing |
| 590 | */ |
| 591 | $this->start_controls_section( |
| 592 | 'eael_section_typography', |
| 593 | [ |
| 594 | 'label' => __('Color, Typography & Spacing', 'essential-addons-for-elementor-lite'), |
| 595 | 'tab' => Controls_Manager::TAB_STYLE, |
| 596 | ] |
| 597 | ); |
| 598 | |
| 599 | $this->add_control( |
| 600 | 'eael_post_grid_title_style', |
| 601 | [ |
| 602 | 'label' => __('Title Style', 'essential-addons-for-elementor-lite'), |
| 603 | 'type' => Controls_Manager::HEADING, |
| 604 | 'separator' => 'before', |
| 605 | ] |
| 606 | ); |
| 607 | |
| 608 | $this->add_control( |
| 609 | 'eael_post_grid_title_color', |
| 610 | [ |
| 611 | 'label' => __('Title Color', 'essential-addons-for-elementor-lite'), |
| 612 | 'type' => Controls_Manager::COLOR, |
| 613 | 'default' => '#303133', |
| 614 | 'selectors' => [ |
| 615 | '{{WRAPPER}} .eael-entry-title a' => 'color: {{VALUE}};', |
| 616 | ], |
| 617 | |
| 618 | ] |
| 619 | ); |
| 620 | |
| 621 | $this->add_control( |
| 622 | 'eael_post_grid_title_hover_color', |
| 623 | [ |
| 624 | 'label' => __('Title Hover Color', 'essential-addons-for-elementor-lite'), |
| 625 | 'type' => Controls_Manager::COLOR, |
| 626 | 'default' => '#23527c', |
| 627 | 'selectors' => [ |
| 628 | '{{WRAPPER}} .eael-entry-title:hover, {{WRAPPER}} .eael-entry-title a:hover' => 'color: {{VALUE}};', |
| 629 | ], |
| 630 | |
| 631 | ] |
| 632 | ); |
| 633 | |
| 634 | $this->add_responsive_control( |
| 635 | 'eael_post_grid_title_alignment', |
| 636 | [ |
| 637 | 'label' => __('Title Alignment', 'essential-addons-for-elementor-lite'), |
| 638 | 'type' => Controls_Manager::CHOOSE, |
| 639 | 'options' => [ |
| 640 | 'left' => [ |
| 641 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 642 | 'icon' => 'eicon-text-align-left', |
| 643 | ], |
| 644 | 'center' => [ |
| 645 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 646 | 'icon' => 'eicon-text-align-center', |
| 647 | ], |
| 648 | 'right' => [ |
| 649 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 650 | 'icon' => 'eicon-text-align-right', |
| 651 | ], |
| 652 | ], |
| 653 | 'selectors' => [ |
| 654 | '{{WRAPPER}} .eael-entry-title' => 'text-align: {{VALUE}};', |
| 655 | ], |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_group_control( |
| 660 | Group_Control_Typography::get_type(), |
| 661 | [ |
| 662 | 'name' => 'eael_post_grid_title_typography', |
| 663 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 664 | 'global' => [ |
| 665 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY |
| 666 | ], |
| 667 | 'selector' => '{{WRAPPER}} .eael-entry-title, {{WRAPPER}} .eael-entry-title a', |
| 668 | ] |
| 669 | ); |
| 670 | |
| 671 | $this->add_responsive_control( |
| 672 | 'eael_post_grid_title_margin', |
| 673 | [ |
| 674 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 675 | 'type' => Controls_Manager::DIMENSIONS, |
| 676 | 'size_units' => ['px', '%', 'em'], |
| 677 | 'selectors' => [ |
| 678 | '{{WRAPPER}} .eael-entry-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 679 | ], |
| 680 | ] |
| 681 | ); |
| 682 | |
| 683 | $this->add_control( |
| 684 | 'eael_post_grid_excerpt_style', |
| 685 | [ |
| 686 | 'label' => __('Excerpt Style', 'essential-addons-for-elementor-lite'), |
| 687 | 'type' => Controls_Manager::HEADING, |
| 688 | 'separator' => 'before', |
| 689 | ] |
| 690 | ); |
| 691 | |
| 692 | $this->add_control( |
| 693 | 'eael_post_grid_excerpt_color', |
| 694 | [ |
| 695 | 'label' => __('Excerpt Color', 'essential-addons-for-elementor-lite'), |
| 696 | 'type' => Controls_Manager::COLOR, |
| 697 | 'default' => '', |
| 698 | 'selectors' => [ |
| 699 | '{{WRAPPER}} .eael-grid-post-excerpt p' => 'color: {{VALUE}};', |
| 700 | ], |
| 701 | ] |
| 702 | ); |
| 703 | |
| 704 | $this->add_responsive_control( |
| 705 | 'eael_post_grid_excerpt_alignment', |
| 706 | [ |
| 707 | 'label' => __('Excerpt Alignment', 'essential-addons-for-elementor-lite'), |
| 708 | 'type' => Controls_Manager::CHOOSE, |
| 709 | 'options' => [ |
| 710 | 'left' => [ |
| 711 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 712 | 'icon' => 'eicon-text-align-left', |
| 713 | ], |
| 714 | 'center' => [ |
| 715 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 716 | 'icon' => 'eicon-text-align-center', |
| 717 | ], |
| 718 | 'right' => [ |
| 719 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 720 | 'icon' => 'eicon-text-align-right', |
| 721 | ], |
| 722 | 'justify' => [ |
| 723 | 'title' => __('Justified', 'essential-addons-for-elementor-lite'), |
| 724 | 'icon' => 'eicon-text-align-justify', |
| 725 | ], |
| 726 | ], |
| 727 | 'selectors' => [ |
| 728 | '{{WRAPPER}} .eael-grid-post-excerpt p' => 'text-align: {{VALUE}};', |
| 729 | ], |
| 730 | ] |
| 731 | ); |
| 732 | |
| 733 | $this->add_group_control( |
| 734 | Group_Control_Typography::get_type(), |
| 735 | [ |
| 736 | 'name' => 'eael_post_grid_excerpt_typography', |
| 737 | 'label' => __('Excerpt Typography', 'essential-addons-for-elementor-lite'), |
| 738 | 'global' => [ |
| 739 | 'default' => Global_Typography::TYPOGRAPHY_TEXT |
| 740 | ], |
| 741 | 'selector' => '{{WRAPPER}} .eael-grid-post-excerpt p', |
| 742 | ] |
| 743 | ); |
| 744 | |
| 745 | $this->add_control( |
| 746 | 'content_height', |
| 747 | [ |
| 748 | 'label' => esc_html__('Content Height', 'essential-addons-for-elementor-lite'), |
| 749 | 'type' => Controls_Manager::SLIDER, |
| 750 | 'size_units' => ['px', '%', 'em'], |
| 751 | 'range' => [ |
| 752 | 'px' => ['max' => 300], |
| 753 | '%' => ['max' => 100], |
| 754 | ], |
| 755 | 'selectors' => [ |
| 756 | '{{WRAPPER}} .eael-grid-post-holder .eael-entry-wrapper' => 'height: {{SIZE}}{{UNIT}};', |
| 757 | ], |
| 758 | ] |
| 759 | ); |
| 760 | |
| 761 | $this->add_responsive_control( |
| 762 | 'eael_post_grid_excerpt_margin', |
| 763 | [ |
| 764 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 765 | 'type' => Controls_Manager::DIMENSIONS, |
| 766 | 'size_units' => ['px', '%', 'em'], |
| 767 | 'selectors' => [ |
| 768 | '{{WRAPPER}} .eael-grid-post-excerpt p' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 769 | ], |
| 770 | ] |
| 771 | ); |
| 772 | |
| 773 | $this->end_controls_section(); |
| 774 | |
| 775 | /** |
| 776 | * Style tab: terms style |
| 777 | */ |
| 778 | $this->start_controls_section( |
| 779 | 'section_meta_terms_style', |
| 780 | [ |
| 781 | 'label' => __('Terms Style', 'essential-addons-for-elementor-lite'), |
| 782 | 'tab' => Controls_Manager::TAB_STYLE, |
| 783 | 'condition' => [ |
| 784 | 'eael_post_grid_preset_style' => 'two', |
| 785 | 'eael_show_post_terms' => 'yes', |
| 786 | ], |
| 787 | ] |
| 788 | ); |
| 789 | $this->add_control( |
| 790 | 'eael_post_grid_terms_color', |
| 791 | [ |
| 792 | 'label' => __('Terms Color', 'essential-addons-for-elementor-lite'), |
| 793 | 'type' => Controls_Manager::COLOR, |
| 794 | 'default' => '', |
| 795 | 'selectors' => [ |
| 796 | '{{WRAPPER}} .post-meta-categories li, {{WRAPPER}} .post-meta-categories li a' => 'color: {{VALUE}};', |
| 797 | ], |
| 798 | ] |
| 799 | ); |
| 800 | |
| 801 | $this->add_responsive_control( |
| 802 | 'eael_post_grid_terms_alignment', |
| 803 | [ |
| 804 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 805 | 'type' => Controls_Manager::CHOOSE, |
| 806 | 'options' => [ |
| 807 | 'flex-start' => [ |
| 808 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 809 | 'icon' => 'eicon-text-align-left', |
| 810 | ], |
| 811 | 'center' => [ |
| 812 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 813 | 'icon' => 'eicon-text-align-center', |
| 814 | ], |
| 815 | 'flex-end' => [ |
| 816 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 817 | 'icon' => 'eicon-text-align-right', |
| 818 | ], |
| 819 | ], |
| 820 | 'default' => 'flex-start', |
| 821 | 'selectors' => [ |
| 822 | '{{WRAPPER}} .eael-grid-post .post-meta-categories' => 'justify-content: {{VALUE}}', |
| 823 | ], |
| 824 | ] |
| 825 | ); |
| 826 | |
| 827 | $this->add_group_control( |
| 828 | Group_Control_Typography::get_type(), |
| 829 | [ |
| 830 | 'name' => 'eael_post_grid_terms_typography', |
| 831 | 'label' => __('Meta Typography', 'essential-addons-for-elementor-lite'), |
| 832 | 'global' => [ |
| 833 | 'default' => Global_Typography::TYPOGRAPHY_TEXT |
| 834 | ], |
| 835 | 'selector' => '{{WRAPPER}} .post-meta-categories li, {{WRAPPER}} .post-meta-categories li a', |
| 836 | ] |
| 837 | ); |
| 838 | |
| 839 | $this->add_control( |
| 840 | 'eael_post_carousel_terms_margin', |
| 841 | [ |
| 842 | 'label' => __('Margin', 'essential-addons-for-elementor-lite'), |
| 843 | 'type' => Controls_Manager::DIMENSIONS, |
| 844 | 'size_units' => ['px', '%', 'em'], |
| 845 | 'selectors' => [ |
| 846 | '{{WRAPPER}} .post-meta-categories' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 847 | ], |
| 848 | ] |
| 849 | ); |
| 850 | $this->end_controls_section(); |
| 851 | |
| 852 | // terms style |
| 853 | $this->start_controls_section( |
| 854 | 'section_terms_style', |
| 855 | [ |
| 856 | 'label' => __('Terms', 'essential-addons-for-elementor-lite'), |
| 857 | 'tab' => Controls_Manager::TAB_STYLE, |
| 858 | 'condition' => [ |
| 859 | 'eael_show_post_terms' => 'yes', |
| 860 | 'eael_post_grid_preset_style' => '', |
| 861 | ], |
| 862 | ] |
| 863 | ); |
| 864 | |
| 865 | $this->add_control( |
| 866 | 'terms_color', |
| 867 | [ |
| 868 | 'label' => __('Color', 'essential-addons-for-elementor-lite'), |
| 869 | 'type' => Controls_Manager::COLOR, |
| 870 | 'default' => '', |
| 871 | 'selectors' => [ |
| 872 | '{{WRAPPER}} .post-carousel-categories li a, {{WRAPPER}} .post-carousel-categories li:after' => 'color: {{VALUE}};', |
| 873 | ], |
| 874 | ] |
| 875 | ); |
| 876 | |
| 877 | $this->add_group_control( |
| 878 | Group_Control_Typography::get_type(), |
| 879 | [ |
| 880 | 'name' => 'terms_typography', |
| 881 | 'label' => __('Typography', 'essential-addons-for-elementor-lite'), |
| 882 | 'selector' => '{{WRAPPER}} .post-carousel-categories li a', |
| 883 | ] |
| 884 | ); |
| 885 | |
| 886 | $this->add_responsive_control( |
| 887 | 'terms_color_alignment', |
| 888 | [ |
| 889 | 'label' => __('Alignment', 'essential-addons-for-elementor-lite'), |
| 890 | 'type' => Controls_Manager::CHOOSE, |
| 891 | 'options' => [ |
| 892 | 'left' => [ |
| 893 | 'title' => __('Left', 'essential-addons-for-elementor-lite'), |
| 894 | 'icon' => 'eicon-text-align-left', |
| 895 | ], |
| 896 | 'center' => [ |
| 897 | 'title' => __('Center', 'essential-addons-for-elementor-lite'), |
| 898 | 'icon' => 'eicon-text-align-center', |
| 899 | ], |
| 900 | 'right' => [ |
| 901 | 'title' => __('Right', 'essential-addons-for-elementor-lite'), |
| 902 | 'icon' => 'eicon-text-align-right', |
| 903 | ], |
| 904 | ], |
| 905 | 'selectors' => [ |
| 906 | '{{WRAPPER}} .post-carousel-categories' => 'text-align: {{VALUE}};', |
| 907 | ], |
| 908 | ] |
| 909 | ); |
| 910 | |
| 911 | $this->add_control( |
| 912 | 'terms_spacing', |
| 913 | [ |
| 914 | 'label' => __('Spacing', 'essential-addons-for-elementor-lite'), |
| 915 | 'type' => Controls_Manager::DIMENSIONS, |
| 916 | 'size_units' => ['px', '%'], |
| 917 | 'selectors' => [ |
| 918 | '{{WRAPPER}} .post-carousel-categories li' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 919 | ], |
| 920 | ] |
| 921 | ); |
| 922 | |
| 923 | $this->end_controls_section(); |
| 924 | |
| 925 | // Card Hover |
| 926 | $this->start_controls_section( |
| 927 | 'eael_section_hover_card_styles', |
| 928 | [ |
| 929 | 'label' => __('Hover Card Style', 'essential-addons-for-elementor-lite'), |
| 930 | 'tab' => Controls_Manager::TAB_STYLE, |
| 931 | ] |
| 932 | ); |
| 933 | |
| 934 | $this->add_control( |
| 935 | 'eael_post_grid_hover_animation', |
| 936 | [ |
| 937 | 'label' => esc_html__('Animation', 'essential-addons-for-elementor-lite'), |
| 938 | 'type' => Controls_Manager::SELECT, |
| 939 | 'default' => 'fade-in', |
| 940 | 'options' => [ |
| 941 | 'none' => esc_html__('None', 'essential-addons-for-elementor-lite'), |
| 942 | 'fade-in' => esc_html__('FadeIn', 'essential-addons-for-elementor-lite'), |
| 943 | 'zoom-in' => esc_html__('ZoomIn', 'essential-addons-for-elementor-lite'), |
| 944 | 'slide-up' => esc_html__('SlideUp', 'essential-addons-for-elementor-lite'), |
| 945 | ], |
| 946 | ] |
| 947 | ); |
| 948 | |
| 949 | $this->add_control( |
| 950 | 'eael_post_grid_bg_hover_icon_new', |
| 951 | [ |
| 952 | 'label' => __('Post Hover Icon', 'essential-addons-for-elementor-lite'), |
| 953 | 'type' => Controls_Manager::ICONS, |
| 954 | 'default' => [ |
| 955 | 'value' => 'fas fa-long-arrow-alt-right', |
| 956 | 'library' => 'fa-solid', |
| 957 | ], |
| 958 | 'condition' => [ |
| 959 | 'eael_post_grid_hover_animation!' => 'none', |
| 960 | ], |
| 961 | ] |
| 962 | ); |
| 963 | |
| 964 | $this->add_control( |
| 965 | 'eael_post_grid_hover_bg_color', |
| 966 | [ |
| 967 | 'label' => __('Background Color', 'essential-addons-for-elementor-lite'), |
| 968 | 'type' => Controls_Manager::COLOR, |
| 969 | 'default' => 'rgba(0,0,0, .75)', |
| 970 | 'selectors' => [ |
| 971 | '{{WRAPPER}} .eael-grid-post .eael-entry-overlay' => 'background-color: {{VALUE}}', |
| 972 | ], |
| 973 | |
| 974 | ] |
| 975 | ); |
| 976 | |
| 977 | $this->add_control( |
| 978 | 'eael_post_grid_hover_bg_radius', |
| 979 | [ |
| 980 | 'label' => esc_html__('Cards Radius', 'essential-addons-for-elementor-lite'), |
| 981 | 'type' => Controls_Manager::DIMENSIONS, |
| 982 | 'selectors' => [ |
| 983 | '{{WRAPPER}} .eael-post-grid .eael-grid-post .eael-entry-media .eael-entry-overlay' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 984 | ], |
| 985 | ] |
| 986 | ); |
| 987 | |
| 988 | $this->add_control( |
| 989 | 'eael_post_grid_hover_icon_color', |
| 990 | [ |
| 991 | 'label' => __('Icon Color', 'essential-addons-for-elementor-lite'), |
| 992 | 'type' => Controls_Manager::COLOR, |
| 993 | 'default' => '#ffffff', |
| 994 | 'selectors' => [ |
| 995 | '{{WRAPPER}} .eael-grid-post .eael-entry-overlay > i' => 'color: {{VALUE}}', |
| 996 | ], |
| 997 | ] |
| 998 | ); |
| 999 | |
| 1000 | $this->add_responsive_control( |
| 1001 | 'eael_post_grid_hover_icon_fontsize', |
| 1002 | [ |
| 1003 | 'label' => __('Icon font size', 'essential-addons-for-elementor-lite'), |
| 1004 | 'type' => Controls_Manager::SLIDER, |
| 1005 | 'default' => [ |
| 1006 | 'unit' => 'px', |
| 1007 | 'size' => 18, |
| 1008 | ], |
| 1009 | 'size_units' => ['px', 'em'], |
| 1010 | 'range' => [ |
| 1011 | 'px' => [ |
| 1012 | 'min' => 0, |
| 1013 | 'max' => 100, |
| 1014 | 'step' => 1, |
| 1015 | ], |
| 1016 | 'em' => [ |
| 1017 | 'min' => 0, |
| 1018 | 'max' => 100, |
| 1019 | 'step' => 1, |
| 1020 | ], |
| 1021 | ], |
| 1022 | 'selectors' => [ |
| 1023 | '{{WRAPPER}} .eael-grid-post .eael-entry-overlay > i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1024 | '{{WRAPPER}} .eael-grid-post .eael-entry-overlay > img' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 1025 | ], |
| 1026 | ] |
| 1027 | ); |
| 1028 | |
| 1029 | $this->end_controls_section(); |
| 1030 | |
| 1031 | /** |
| 1032 | * Read More Button Style Controls |
| 1033 | */ |
| 1034 | do_action('eael/controls/read_more_button_style', $this); |
| 1035 | |
| 1036 | /** |
| 1037 | * Load More Button Style Controls! |
| 1038 | */ |
| 1039 | do_action('eael/controls/load_more_button_style', $this); |
| 1040 | } |
| 1041 | |
| 1042 | protected function render() |
| 1043 | { |
| 1044 | $settings = $this->get_settings(); |
| 1045 | $settings = HelperClass::fix_old_query($settings); |
| 1046 | $args = HelperClass::get_query_args($settings); |
| 1047 | $args = HelperClass::get_dynamic_args($settings, $args); |
| 1048 | |
| 1049 | if ( ! in_array( $settings['post_type'], [ 'post', 'page', 'product', 'by_id', 'source_dynamic' ] ) ) { |
| 1050 | $settings['eael_post_terms'] = empty( $settings["eael_{$settings['post_type']}_terms"] ) ? '' : $settings["eael_{$settings['post_type']}_terms"]; |
| 1051 | } elseif ( $settings['post_type'] === 'product' ) { |
| 1052 | $settings['eael_post_terms'] = $settings['eael_post_terms'] === 'category' ? 'product_cat' : ( $settings['eael_post_terms'] === 'tags' ? 'product_tag' : $settings['eael_post_terms'] ); |
| 1053 | } |
| 1054 | |
| 1055 | $link_settings = [ |
| 1056 | 'image_link_nofollow' => $settings['image_link_nofollow'] ? 'rel="nofollow"' : '', |
| 1057 | 'image_link_target_blank' => $settings['image_link_target_blank'] ? 'target="_blank"' : '', |
| 1058 | 'title_link_nofollow' => $settings['title_link_nofollow'] ? 'rel="nofollow"' : '', |
| 1059 | 'title_link_target_blank' => $settings['title_link_target_blank'] ? 'target="_blank"' : '', |
| 1060 | 'read_more_link_nofollow' => $settings['read_more_link_nofollow'] ? 'rel="nofollow"' : '', |
| 1061 | 'read_more_link_target_blank' => $settings['read_more_link_target_blank'] ? 'target="_blank"' : '', |
| 1062 | ]; |
| 1063 | |
| 1064 | $this->add_render_attribute( |
| 1065 | 'post_grid_wrapper', |
| 1066 | [ |
| 1067 | 'id' => 'eael-post-grid-' . esc_attr($this->get_id()), |
| 1068 | 'class' => [ |
| 1069 | 'eael-post-grid-container', |
| 1070 | ], |
| 1071 | ] |
| 1072 | ); |
| 1073 | |
| 1074 | $this->add_render_attribute( |
| 1075 | 'post_grid_container', |
| 1076 | [ |
| 1077 | 'class' => [ |
| 1078 | 'eael-post-grid', |
| 1079 | 'eael-post-appender', |
| 1080 | 'eael-post-appender-' . $this->get_id(), |
| 1081 | 'eael-post-grid-style-' . ($settings['eael_post_grid_preset_style'] !== "" ? $settings['eael_post_grid_preset_style'] : 'default'), |
| 1082 | ], |
| 1083 | ] |
| 1084 | ); |
| 1085 | |
| 1086 | echo '<div '; $this->print_render_attribute_string( 'post_grid_wrapper' ); echo '> |
| 1087 | <div '; $this->print_render_attribute_string( 'post_grid_container' ); echo ' data-layout-mode="' . esc_attr( $settings["layout_mode"] ) . '">'; |
| 1088 | |
| 1089 | $template = $this->get_template($settings['eael_dynamic_template_Layout']); |
| 1090 | $settings['loadable_file_name'] = $this->get_filename_only($template); |
| 1091 | $dir_name = $this->get_temp_dir_name($settings['loadable_file_name']); |
| 1092 | $found_posts = 0; |
| 1093 | $posts_per_page = isset($args['posts_per_page']) && $args['posts_per_page'] > 0 ? $args['posts_per_page'] : -1 ; |
| 1094 | |
| 1095 | set_transient( 'eael_post_grid_read_more_button_text_'. $this->get_id(), $this->get_settings_for_display('read_more_button_text'), DAY_IN_SECONDS ); |
| 1096 | set_transient( 'eael_post_grid_excerpt_expanison_indicator_'. $this->get_id(), $this->get_settings_for_display('excerpt_expanison_indicator'), DAY_IN_SECONDS ); |
| 1097 | $settings['read_more_button_text'] = $this->get_settings_for_display('read_more_button_text'); |
| 1098 | $settings['excerpt_expanison_indicator'] = $this->get_settings_for_display('excerpt_expanison_indicator'); |
| 1099 | |
| 1100 | $args['ignore_sticky_posts'] = isset( $settings['ignore_sticky_posts'] ) && 'yes' === $settings['ignore_sticky_posts']; |
| 1101 | |
| 1102 | if(file_exists($template)){ |
| 1103 | $query = new \WP_Query( $args ); |
| 1104 | |
| 1105 | if ( $query->have_posts() ) { |
| 1106 | $found_posts = $query->found_posts; |
| 1107 | $max_page = ceil( $found_posts / absint( $posts_per_page ) ); |
| 1108 | $args['max_page'] = $max_page; |
| 1109 | |
| 1110 | while ( $query->have_posts() ) { |
| 1111 | $query->the_post(); |
| 1112 | include($template); |
| 1113 | } |
| 1114 | }else { |
| 1115 | echo '<p class="no-posts-found">' . esc_html__( 'No posts found!', 'essential-addons-for-elementor-lite' ) . '</p>'; |
| 1116 | } |
| 1117 | wp_reset_postdata(); |
| 1118 | } else { |
| 1119 | echo '<p class="no-posts-found">' . esc_html__( 'No Layout Found', 'essential-addons-for-elementor-lite' ) . '</p>'; |
| 1120 | } |
| 1121 | |
| 1122 | |
| 1123 | echo '</div> |
| 1124 | <div class="clearfix"></div> |
| 1125 | </div>'; |
| 1126 | |
| 1127 | if ( $found_posts > $posts_per_page ) { |
| 1128 | $this->print_load_more_button( $settings, $args, $dir_name ); |
| 1129 | } |
| 1130 | |
| 1131 | if (Plugin::instance()->editor->is_edit_mode()) {?> |
| 1132 | <script type="text/javascript"> |
| 1133 | jQuery(document).ready(function($) { |
| 1134 | jQuery(".eael-post-grid").each(function() { |
| 1135 | var $scope = jQuery(".elementor-element-<?php echo esc_js( $this->get_id() ); ?>"), |
| 1136 | $gallery = $(this), |
| 1137 | $layout_mode = $gallery.data('layout-mode'); |
| 1138 | |
| 1139 | if ( $layout_mode === 'masonry' ) { |
| 1140 | // init isotope |
| 1141 | var $isotope_gallery = $gallery.isotope({ |
| 1142 | itemSelector: ".eael-grid-post", |
| 1143 | layoutMode: $layout_mode, |
| 1144 | percentPosition: true |
| 1145 | }); |
| 1146 | |
| 1147 | // layout gal, while images are loading |
| 1148 | $isotope_gallery.imagesLoaded().progress(function() { |
| 1149 | $isotope_gallery.isotope("layout"); |
| 1150 | }); |
| 1151 | |
| 1152 | $('.eael-grid-post', $gallery).resize(function() { |
| 1153 | $isotope_gallery.isotope("layout"); |
| 1154 | }); |
| 1155 | } |
| 1156 | }); |
| 1157 | }); |
| 1158 | </script> |
| 1159 | <?php |
| 1160 | } |
| 1161 | } |
| 1162 | } |
| 1163 |