| 1 |
<?php |
| 2 |
namespace Enteraddons\Widgets\Recent_Posts; |
| 3 |
|
| 4 |
use Elementor\Widget_Base; |
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Scheme_Color; |
| 7 |
use Elementor\Scheme_Typography; |
| 8 |
use Elementor\Group_Control_Typography; |
| 9 |
use Elementor\Group_Control_Box_Shadow; |
| 10 |
use Elementor\Group_Control_Background; |
| 11 |
use Elementor\Group_Control_Border; |
| 12 |
|
| 13 |
// Exit if accessed directly |
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* |
| 20 |
* Enteraddons elementor Recent Posts widget. |
| 21 |
* |
| 22 |
* @since 1.0 |
| 23 |
*/ |
| 24 |
|
| 25 |
class Recent_Posts extends Widget_Base { |
| 26 |
|
| 27 |
public function get_name() { |
| 28 |
return 'enteraddons-recent-posts'; |
| 29 |
} |
| 30 |
|
| 31 |
public function get_title() { |
| 32 |
return esc_html__( 'Recent Posts', 'enteraddons' ); |
| 33 |
} |
| 34 |
|
| 35 |
public function get_icon() { |
| 36 |
return 'entera entera-post-grid'; |
| 37 |
} |
| 38 |
|
| 39 |
public function get_categories() { |
| 40 |
return ['enteraddons-elements-category']; |
| 41 |
} |
| 42 |
|
| 43 |
protected function register_controls() { |
| 44 |
|
| 45 |
// ---------------------------------------- Recent Posts Content ------------------------------ |
| 46 |
$this->start_controls_section( |
| 47 |
'enteraddons_recent_posts_content_settings', |
| 48 |
[ |
| 49 |
'label' => esc_html__( 'Recent Posts Content', 'enteraddons' ), |
| 50 |
] |
| 51 |
); |
| 52 |
$this->add_control( |
| 53 |
'limit', |
| 54 |
[ |
| 55 |
'label' => esc_html__( 'Post Limit', 'enteraddons' ), |
| 56 |
'type' => \Elementor\Controls_Manager::NUMBER, |
| 57 |
'default' => '2' |
| 58 |
] |
| 59 |
); |
| 60 |
$this->add_control( |
| 61 |
'categories', |
| 62 |
[ |
| 63 |
'label' => esc_html__( 'Categories', 'enteraddons' ), |
| 64 |
'type' => \Elementor\Controls_Manager::SELECT2, |
| 65 |
'label_block' => true, |
| 66 |
'multiple' => true, |
| 67 |
'default' => '', |
| 68 |
'options' => \Enteraddons\Classes\Helper::ea_post_categoris() |
| 69 |
] |
| 70 |
); |
| 71 |
$this->add_control( |
| 72 |
'show_post_date', |
| 73 |
[ |
| 74 |
'label' => esc_html__( 'Show Post Date', 'enteraddons' ), |
| 75 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 76 |
'label_on' => esc_html__( 'Show', 'enteraddons' ), |
| 77 |
'label_off' => esc_html__( 'Hide', 'enteraddons' ), |
| 78 |
'return_value' => 'yes', |
| 79 |
'default' => 'yes', |
| 80 |
] |
| 81 |
); |
| 82 |
$this->add_control( |
| 83 |
'show_post_image', |
| 84 |
[ |
| 85 |
'label' => esc_html__( 'Show Thumbnail', 'enteraddons' ), |
| 86 |
'type' => \Elementor\Controls_Manager::SWITCHER, |
| 87 |
'label_on' => esc_html__( 'Show', 'enteraddons' ), |
| 88 |
'label_off' => esc_html__( 'Hide', 'enteraddons' ), |
| 89 |
'return_value' => 'yes', |
| 90 |
'default' => 'yes', |
| 91 |
] |
| 92 |
); |
| 93 |
$this->add_control( |
| 94 |
'title_tag', |
| 95 |
[ |
| 96 |
'label' => esc_html__( 'Title Tag', 'enteraddons' ), |
| 97 |
'type' => \Elementor\Controls_Manager::SELECT, |
| 98 |
'label_block' => true, |
| 99 |
'default' => 'h6', |
| 100 |
'options' => [ |
| 101 |
'h1' => 'H1', |
| 102 |
'h2' => 'H2', |
| 103 |
'h3' => 'H3', |
| 104 |
'h4' => 'H4', |
| 105 |
'h5' => 'H5', |
| 106 |
'h6' => 'H6' |
| 107 |
] |
| 108 |
] |
| 109 |
); |
| 110 |
$this->add_responsive_control( |
| 111 |
'image_layout', |
| 112 |
[ |
| 113 |
'label' => esc_html__( 'Thumbnail Position', 'enteraddons' ), |
| 114 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 115 |
'options' => [ |
| 116 |
'row' => [ |
| 117 |
'title' => esc_html__( 'Left Thumbnail', 'enteraddons' ), |
| 118 |
'icon' => 'eicon-h-align-left', |
| 119 |
], |
| 120 |
'column' => [ |
| 121 |
'title' => esc_html__( 'Top Thumbnail', 'enteraddons' ), |
| 122 |
'icon' => 'eicon-v-align-top', |
| 123 |
], |
| 124 |
'column-reverse' => [ |
| 125 |
'title' => esc_html__( 'Bottom Thumbnail', 'enteraddons' ), |
| 126 |
'icon' => ' eicon-v-align-bottom', |
| 127 |
], |
| 128 |
], |
| 129 |
'default' => 'row', |
| 130 |
'toggle' => true, |
| 131 |
'selectors' => [ |
| 132 |
'{{WRAPPER}} .ea-recent-posts' => 'flex-direction: {{VALUE}} !important', |
| 133 |
], |
| 134 |
] |
| 135 |
); |
| 136 |
$this->end_controls_section(); // End Recent Posts content |
| 137 |
|
| 138 |
// ---------------------------------------- Content Ordering ------------------------------ |
| 139 |
$this->start_controls_section( |
| 140 |
'enteraddons_content_order_settings', |
| 141 |
[ |
| 142 |
'label' => esc_html__( 'Content Ordering', 'enteraddons' ), |
| 143 |
] |
| 144 |
); |
| 145 |
$this->add_responsive_control( |
| 146 |
'title_order', |
| 147 |
[ |
| 148 |
'label' => esc_html__( 'Title Order', 'enteraddons' ), |
| 149 |
'type' => Controls_Manager::SLIDER, |
| 150 |
'size_units' => [ 'px' ], |
| 151 |
'default' => [ |
| 152 |
'unit' => 'px', |
| 153 |
'size' => 1, |
| 154 |
], |
| 155 |
'selectors' => [ |
| 156 |
'{{WRAPPER}} .ea-repost-title' => 'order: {{SIZE}};', |
| 157 |
], |
| 158 |
] |
| 159 |
); |
| 160 |
$this->add_responsive_control( |
| 161 |
'date_order', |
| 162 |
[ |
| 163 |
'label' => esc_html__( 'Date Order', 'enteraddons' ), |
| 164 |
'type' => Controls_Manager::SLIDER, |
| 165 |
'size_units' => [ 'px' ], |
| 166 |
'default' => [ |
| 167 |
'unit' => 'px', |
| 168 |
'size' => 2, |
| 169 |
], |
| 170 |
'selectors' => [ |
| 171 |
'{{WRAPPER}} .ea-posted-on' => 'order: {{SIZE}};', |
| 172 |
], |
| 173 |
] |
| 174 |
); |
| 175 |
$this->end_controls_section(); // End content ordering |
| 176 |
|
| 177 |
/** |
| 178 |
* Style Tab |
| 179 |
* ------------------------------ Recent Post Wrapper Style ------------------------------ |
| 180 |
* |
| 181 |
*/ |
| 182 |
$this->start_controls_section( |
| 183 |
'enteraddons_recent_post_wrapper_style_settings', [ |
| 184 |
'label' => esc_html__( 'Wrapper Style', 'enteraddons' ), |
| 185 |
'tab' => Controls_Manager::TAB_STYLE, |
| 186 |
] |
| 187 |
); |
| 188 |
$this->add_responsive_control( |
| 189 |
'post_alignment', |
| 190 |
[ |
| 191 |
'label' => esc_html__( 'Post Alignment', 'enteraddons' ), |
| 192 |
'condition' => [ |
| 193 |
'image_layout' => 'row', |
| 194 |
], |
| 195 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 196 |
'options' => [ |
| 197 |
'left' => [ |
| 198 |
'title' => esc_html__( 'Left', 'enteraddons' ), |
| 199 |
'icon' => 'eicon-text-align-left', |
| 200 |
], |
| 201 |
'center' => [ |
| 202 |
'title' => esc_html__( 'Center', 'enteraddons' ), |
| 203 |
'icon' => 'eicon-text-align-center', |
| 204 |
], |
| 205 |
'right' => [ |
| 206 |
'title' => esc_html__( 'Right', 'enteraddons' ), |
| 207 |
'icon' => 'eicon-text-align-right', |
| 208 |
] |
| 209 |
], |
| 210 |
'default' => 'left', |
| 211 |
'toggle' => true, |
| 212 |
'selectors' => [ |
| 213 |
'{{WRAPPER}} .ea-recent-posts' => 'justify-content:{{VALUE}};', |
| 214 |
], |
| 215 |
] |
| 216 |
); |
| 217 |
$this->add_responsive_control( |
| 218 |
'content_alignment', |
| 219 |
[ |
| 220 |
'label' => esc_html__( 'Content Alignment', 'enteraddons' ), |
| 221 |
'type' => \Elementor\Controls_Manager::CHOOSE, |
| 222 |
'options' => [ |
| 223 |
'left' => [ |
| 224 |
'title' => esc_html__( 'Left', 'enteraddons' ), |
| 225 |
'icon' => 'eicon-text-align-left', |
| 226 |
], |
| 227 |
'center' => [ |
| 228 |
'title' => esc_html__( 'Center', 'enteraddons' ), |
| 229 |
'icon' => 'eicon-text-align-center', |
| 230 |
], |
| 231 |
'right' => [ |
| 232 |
'title' => esc_html__( 'Right', 'enteraddons' ), |
| 233 |
'icon' => 'eicon-text-align-right', |
| 234 |
] |
| 235 |
], |
| 236 |
'default' => 'left', |
| 237 |
'toggle' => true, |
| 238 |
'selectors' => [ |
| 239 |
'{{WRAPPER}} .ea-repost-content' => 'text-align:{{VALUE}};', |
| 240 |
], |
| 241 |
] |
| 242 |
); |
| 243 |
$this->add_responsive_control( |
| 244 |
'wrapper_margin', |
| 245 |
[ |
| 246 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 247 |
'type' => Controls_Manager::DIMENSIONS, |
| 248 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 249 |
'size_units' => [ 'px', '%', 'em' ], |
| 250 |
'selectors' => [ |
| 251 |
'{{WRAPPER}} .ea-recent-posts' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 252 |
], |
| 253 |
] |
| 254 |
); |
| 255 |
$this->add_responsive_control( |
| 256 |
'wrapper_padding', |
| 257 |
[ |
| 258 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 259 |
'type' => Controls_Manager::DIMENSIONS, |
| 260 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 261 |
'size_units' => [ 'px', '%', 'em' ], |
| 262 |
'selectors' => [ |
| 263 |
'{{WRAPPER}} .ea-recent-posts' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 264 |
], |
| 265 |
] |
| 266 |
); |
| 267 |
$this->add_group_control( |
| 268 |
\Elementor\Group_Control_Border::get_type(), |
| 269 |
[ |
| 270 |
'name' => 'wrapper_border', |
| 271 |
'label' => esc_html__( 'Border', 'enteraddons' ), |
| 272 |
'selector' => '{{WRAPPER}} .ea-recent-posts', |
| 273 |
] |
| 274 |
); |
| 275 |
$this->add_responsive_control( |
| 276 |
'wrapper_radius', |
| 277 |
[ |
| 278 |
'label' => esc_html__( 'Border Radius', 'enteraddons' ), |
| 279 |
'type' => Controls_Manager::DIMENSIONS, |
| 280 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 281 |
'size_units' => [ 'px', '%', 'em' ], |
| 282 |
'selectors' => [ |
| 283 |
'{{WRAPPER}} .ea-recent-posts' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};' |
| 284 |
], |
| 285 |
] |
| 286 |
); |
| 287 |
$this->add_group_control( |
| 288 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 289 |
[ |
| 290 |
'name' => 'wrapper_shadow', |
| 291 |
'label' => esc_html__( 'Box Shadow', 'enteraddons' ), |
| 292 |
'selector' => '{{WRAPPER}} .ea-recent-posts', |
| 293 |
] |
| 294 |
); |
| 295 |
$this->add_group_control( |
| 296 |
\Elementor\Group_Control_Background::get_type(), |
| 297 |
[ |
| 298 |
'name' => 'wrapper_background', |
| 299 |
'label' => esc_html__( 'Background', 'enteraddons' ), |
| 300 |
'types' => [ 'classic', 'gradient' ], |
| 301 |
'selector' => '{{WRAPPER}} .ea-recent-posts', |
| 302 |
] |
| 303 |
); |
| 304 |
$this->end_controls_section(); |
| 305 |
|
| 306 |
/** |
| 307 |
* Style Tab |
| 308 |
* ------------------------------ Recent Post Image Style ------------------------------ |
| 309 |
* |
| 310 |
*/ |
| 311 |
$this->start_controls_section( |
| 312 |
'enteraddons_recent_post_image_style', [ |
| 313 |
'label' => esc_html__( 'Thumbnail Style', 'enteraddons' ), |
| 314 |
'tab' => Controls_Manager::TAB_STYLE, |
| 315 |
] |
| 316 |
); |
| 317 |
|
| 318 |
$this->add_responsive_control( |
| 319 |
'img_width', |
| 320 |
[ |
| 321 |
'label' => esc_html__( 'Image Width', 'enteraddons' ), |
| 322 |
'type' => Controls_Manager::SLIDER, |
| 323 |
'size_units' => [ 'px', '%' ], |
| 324 |
'range' => [ |
| 325 |
'px' => [ |
| 326 |
'min' => 0, |
| 327 |
'max' => 1000, |
| 328 |
'step' => 1, |
| 329 |
], |
| 330 |
'%' => [ |
| 331 |
'min' => 0, |
| 332 |
'max' => 100, |
| 333 |
], |
| 334 |
], |
| 335 |
'default' => [ |
| 336 |
'unit' => 'px', |
| 337 |
'size' => '', |
| 338 |
], |
| 339 |
'selectors' => [ |
| 340 |
'{{WRAPPER}} .ea-recent-posts .ea-repost-image' => 'width: {{SIZE}}{{UNIT}};', |
| 341 |
], |
| 342 |
] |
| 343 |
); |
| 344 |
$this->add_responsive_control( |
| 345 |
'img_height', |
| 346 |
[ |
| 347 |
'label' => esc_html__( 'Image Height', 'enteraddons' ), |
| 348 |
'type' => Controls_Manager::SLIDER, |
| 349 |
'size_units' => [ 'px', '%'], |
| 350 |
'range' => [ |
| 351 |
'px' => [ |
| 352 |
'min' => 0, |
| 353 |
'max' => 1000, |
| 354 |
'step' => 1, |
| 355 |
], |
| 356 |
'%' => [ |
| 357 |
'min' => 0, |
| 358 |
'max' => 100, |
| 359 |
], |
| 360 |
], |
| 361 |
'default' => [ |
| 362 |
'unit' => '%', |
| 363 |
'size' => '', |
| 364 |
], |
| 365 |
'selectors' => [ |
| 366 |
'{{WRAPPER}} .ea-recent-posts .ea-repost-image ' => 'height: {{SIZE}}{{UNIT}};', |
| 367 |
], |
| 368 |
] |
| 369 |
); |
| 370 |
$this->add_responsive_control( |
| 371 |
'img_margin', |
| 372 |
[ |
| 373 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 374 |
'type' => Controls_Manager::DIMENSIONS, |
| 375 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 376 |
'size_units' => [ 'px', '%', 'em' ], |
| 377 |
'selectors' => [ |
| 378 |
'{{WRAPPER}} .ea-recent-posts .ea-repost-image' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 379 |
], |
| 380 |
] |
| 381 |
); |
| 382 |
$this->add_responsive_control( |
| 383 |
'img_padding', |
| 384 |
[ |
| 385 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 386 |
'type' => Controls_Manager::DIMENSIONS, |
| 387 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 388 |
'size_units' => [ 'px', '%', 'em' ], |
| 389 |
'selectors' => [ |
| 390 |
'{{WRAPPER}} .ea-recent-posts .ea-repost-image' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 391 |
], |
| 392 |
] |
| 393 |
); |
| 394 |
$this->add_group_control( |
| 395 |
\Elementor\Group_Control_Border::get_type(), |
| 396 |
[ |
| 397 |
'name' => 'img_border', |
| 398 |
'label' => esc_html__( 'Border', 'enteraddons' ), |
| 399 |
'selector' => '{{WRAPPER}} .ea-recent-posts .ea-repost-image', |
| 400 |
] |
| 401 |
); |
| 402 |
$this->add_responsive_control( |
| 403 |
'img_border_radius', |
| 404 |
[ |
| 405 |
'label' => esc_html__( 'Border Radius', 'enteraddons' ), |
| 406 |
'type' => Controls_Manager::DIMENSIONS, |
| 407 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 408 |
'size_units' => [ 'px', '%', 'em' ], |
| 409 |
'selectors' => [ |
| 410 |
'{{WRAPPER}} .ea-recent-posts .ea-repost-image' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 411 |
], |
| 412 |
] |
| 413 |
); |
| 414 |
$this->add_group_control( |
| 415 |
\Elementor\Group_Control_Box_Shadow::get_type(), |
| 416 |
[ |
| 417 |
'name' => 'img_box_shadow', |
| 418 |
'label' => esc_html__( 'Box Shadow', 'enteraddons' ), |
| 419 |
'selector' => '{{WRAPPER}} .ea-recent-posts .ea-repost-image', |
| 420 |
] |
| 421 |
); |
| 422 |
$this->end_controls_section(); |
| 423 |
|
| 424 |
/** |
| 425 |
* Style Tab |
| 426 |
* ------------------------------ Recent Post Title Style Settings ------------------------------ |
| 427 |
* |
| 428 |
*/ |
| 429 |
$this->start_controls_section( |
| 430 |
'enteraddons_recent_post_title_settings', [ |
| 431 |
'label' => esc_html__( 'Title Style', 'enteraddons' ), |
| 432 |
'tab' => Controls_Manager::TAB_STYLE, |
| 433 |
] |
| 434 |
); |
| 435 |
|
| 436 |
$this->start_controls_tabs( 'tab_repost_title' ); |
| 437 |
|
| 438 |
// Controls tab For Normal |
| 439 |
$this->start_controls_tab( |
| 440 |
'title_normal', |
| 441 |
[ |
| 442 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 443 |
] |
| 444 |
); |
| 445 |
$this->add_control( |
| 446 |
'title_color', |
| 447 |
[ |
| 448 |
'label' => esc_html__( 'Title Color', 'enteraddons' ), |
| 449 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 450 |
'selectors' => [ |
| 451 |
'{{WRAPPER}} .ea-repost-title-tag' => 'color: {{VALUE}}', |
| 452 |
], |
| 453 |
] |
| 454 |
); |
| 455 |
$this->add_group_control( |
| 456 |
\Elementor\Group_Control_Typography::get_type(), |
| 457 |
[ |
| 458 |
'name' => 'title_typography', |
| 459 |
'label' => esc_html__( 'Typography', 'enteraddons' ), |
| 460 |
'selector' => '{{WRAPPER}} .ea-repost-title-tag', |
| 461 |
] |
| 462 |
); |
| 463 |
$this->add_group_control( |
| 464 |
\Elementor\Group_Control_Text_Stroke::get_type(), |
| 465 |
[ |
| 466 |
'name' => 'text_stroke', |
| 467 |
'selector' => '{{WRAPPER}} .ea-repost-title-tag', |
| 468 |
] |
| 469 |
); |
| 470 |
$this->add_responsive_control( |
| 471 |
'title_margin', |
| 472 |
[ |
| 473 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 474 |
'type' => Controls_Manager::DIMENSIONS, |
| 475 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 476 |
'size_units' => [ 'px', '%', 'em' ], |
| 477 |
'selectors' => [ |
| 478 |
'{{WRAPPER}} .ea-repost-title-tag' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 479 |
], |
| 480 |
] |
| 481 |
); |
| 482 |
$this->add_responsive_control( |
| 483 |
'title_padding', |
| 484 |
[ |
| 485 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 486 |
'type' => Controls_Manager::DIMENSIONS, |
| 487 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 488 |
'size_units' => [ 'px', '%', 'em' ], |
| 489 |
'selectors' => [ |
| 490 |
'{{WRAPPER}} .ea-repost-title-tag' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 491 |
], |
| 492 |
] |
| 493 |
); |
| 494 |
$this->end_controls_tab(); // End Controls tab |
| 495 |
|
| 496 |
// Controls tab For Hover |
| 497 |
$this->start_controls_tab( |
| 498 |
'title_hover', |
| 499 |
[ |
| 500 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 501 |
] |
| 502 |
); |
| 503 |
$this->add_control( |
| 504 |
'title_hover_color', |
| 505 |
[ |
| 506 |
'label' => esc_html__( 'Title Hover Color', 'enteraddons' ), |
| 507 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 508 |
'selectors' => [ |
| 509 |
'{{WRAPPER}} .ea-repost-title-tag:hover' => 'color: {{VALUE}}', |
| 510 |
], |
| 511 |
] |
| 512 |
); |
| 513 |
$this->add_responsive_control( |
| 514 |
'title_hover_margin', |
| 515 |
[ |
| 516 |
'label' => esc_html__( 'Hover Margin', 'enteraddons' ), |
| 517 |
'type' => Controls_Manager::DIMENSIONS, |
| 518 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 519 |
'size_units' => [ 'px', '%', 'em' ], |
| 520 |
'selectors' => [ |
| 521 |
'{{WRAPPER}} .ea-repost-title-tag:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 522 |
], |
| 523 |
] |
| 524 |
); |
| 525 |
$this->add_group_control( |
| 526 |
\Elementor\Group_Control_Text_Stroke::get_type(), |
| 527 |
[ |
| 528 |
'name' => 'text_hover_stroke', |
| 529 |
'selector' => '{{WRAPPER}} .ea-repost-title-tag:hover', |
| 530 |
] |
| 531 |
); |
| 532 |
|
| 533 |
$this->end_controls_tab(); // End Controls tab |
| 534 |
$this->end_controls_tabs(); // end controls tabs section |
| 535 |
$this->end_controls_section(); |
| 536 |
|
| 537 |
/** |
| 538 |
* Style Tab |
| 539 |
* ------------------------------ Recent Post Date Style Settings ------------------------------ |
| 540 |
* |
| 541 |
*/ |
| 542 |
$this->start_controls_section( |
| 543 |
'enteraddons_recent_post_date_settings', [ |
| 544 |
'label' => esc_html__( 'Date Style', 'enteraddons' ), |
| 545 |
'tab' => Controls_Manager::TAB_STYLE, |
| 546 |
] |
| 547 |
); |
| 548 |
|
| 549 |
$this->start_controls_tabs( 'tab_repost_date' ); |
| 550 |
|
| 551 |
// Controls tab For Normal |
| 552 |
$this->start_controls_tab( |
| 553 |
'date_normal', |
| 554 |
[ |
| 555 |
'label' => esc_html__( 'Normal', 'enteraddons' ), |
| 556 |
] |
| 557 |
); |
| 558 |
$this->add_control( |
| 559 |
'date_color', |
| 560 |
[ |
| 561 |
'label' => esc_html__( 'Color', 'enteraddons' ), |
| 562 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 563 |
'selectors' => [ |
| 564 |
'{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link' => 'color: {{VALUE}}', |
| 565 |
], |
| 566 |
] |
| 567 |
); |
| 568 |
$this->add_group_control( |
| 569 |
\Elementor\Group_Control_Typography::get_type(), |
| 570 |
[ |
| 571 |
'name' => 'date_typography', |
| 572 |
'label' => esc_html__( 'Typography', 'enteraddons' ), |
| 573 |
'selector' => '{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link', |
| 574 |
] |
| 575 |
); |
| 576 |
$this->add_group_control( |
| 577 |
\Elementor\Group_Control_Text_Stroke::get_type(), |
| 578 |
[ |
| 579 |
'name' => 'date_stroke', |
| 580 |
'selector' => '{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link', |
| 581 |
] |
| 582 |
); |
| 583 |
$this->add_responsive_control( |
| 584 |
'date_margin', |
| 585 |
[ |
| 586 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 587 |
'type' => Controls_Manager::DIMENSIONS, |
| 588 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 589 |
'size_units' => [ 'px', '%', 'em' ], |
| 590 |
'selectors' => [ |
| 591 |
'{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 592 |
], |
| 593 |
] |
| 594 |
); |
| 595 |
$this->add_responsive_control( |
| 596 |
'date_padding', |
| 597 |
[ |
| 598 |
'label' => esc_html__( 'Padding', 'enteraddons' ), |
| 599 |
'type' => Controls_Manager::DIMENSIONS, |
| 600 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 601 |
'size_units' => [ 'px', '%', 'em' ], |
| 602 |
'selectors' => [ |
| 603 |
'{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 604 |
], |
| 605 |
] |
| 606 |
); |
| 607 |
$this->end_controls_tab(); // End Controls tab |
| 608 |
|
| 609 |
// Controls tab For Hover |
| 610 |
$this->start_controls_tab( |
| 611 |
'date_hover', |
| 612 |
[ |
| 613 |
'label' => esc_html__( 'Hover', 'enteraddons' ), |
| 614 |
] |
| 615 |
); |
| 616 |
$this->add_control( |
| 617 |
'date_hover_color', |
| 618 |
[ |
| 619 |
'label' => esc_html__( 'Color', 'enteraddons' ), |
| 620 |
'type' => \Elementor\Controls_Manager::COLOR, |
| 621 |
'selectors' => [ |
| 622 |
'{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link:hover' => 'color: {{VALUE}}', |
| 623 |
], |
| 624 |
] |
| 625 |
); |
| 626 |
$this->add_responsive_control( |
| 627 |
'date_hover_margin', |
| 628 |
[ |
| 629 |
'label' => esc_html__( 'Margin', 'enteraddons' ), |
| 630 |
'type' => Controls_Manager::DIMENSIONS, |
| 631 |
'devices' => [ 'desktop', 'tablet', 'mobile' ], |
| 632 |
'size_units' => [ 'px', '%', 'em' ], |
| 633 |
'selectors' => [ |
| 634 |
'{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link:hover' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 635 |
], |
| 636 |
] |
| 637 |
); |
| 638 |
$this->add_group_control( |
| 639 |
\Elementor\Group_Control_Text_Stroke::get_type(), |
| 640 |
[ |
| 641 |
'name' => 'date_hover_stroke', |
| 642 |
'selector' => '{{WRAPPER}} .ea-recent-posts .ea-posted-on .ea-date-link:hover', |
| 643 |
] |
| 644 |
); |
| 645 |
$this->end_controls_tab(); // End Controls tab |
| 646 |
$this->end_controls_tabs(); // end controls tabs section |
| 647 |
$this->end_controls_section(); |
| 648 |
|
| 649 |
|
| 650 |
|
| 651 |
} |
| 652 |
|
| 653 |
protected function render() { |
| 654 |
|
| 655 |
// get settings |
| 656 |
$settings = $this->get_settings_for_display(); |
| 657 |
|
| 658 |
// Template render |
| 659 |
$obj = new Recent_Posts_Template(); |
| 660 |
$obj::setDisplaySettings( $settings ); |
| 661 |
$obj->renderTemplate(); |
| 662 |
|
| 663 |
} |
| 664 |
|
| 665 |
public function get_style_depends() { |
| 666 |
return [ 'enteraddons-global-style']; |
| 667 |
} |
| 668 |
|
| 669 |
} |
| 670 |
|