| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimatePostKit\Modules\AlterCarousel\Widgets; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Border; |
| 7 |
use Elementor\Group_Control_Box_Shadow; |
| 8 |
use Elementor\Group_Control_Typography; |
| 9 |
use Elementor\Group_Control_Text_Shadow; |
| 10 |
use Elementor\Group_Control_Image_Size; |
| 11 |
use Elementor\Group_Control_Background; |
| 12 |
use Elementor\Icons_Manager; |
| 13 |
|
| 14 |
use UltimatePostKit\Traits\Global_Widget_Controls; |
| 15 |
use UltimatePostKit\Traits\Global_Widget_Functions; |
| 16 |
use UltimatePostKit\Traits\Global_Swiper_Functions; |
| 17 |
use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query; |
| 18 |
use WP_Query; |
| 19 |
|
| 20 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 21 |
|
| 22 |
class Alter_Carousel extends Group_Control_Query |
| 23 |
{ |
| 24 |
|
| 25 |
use Global_Widget_Controls; |
| 26 |
use Global_Widget_Functions; |
| 27 |
use Global_Swiper_Functions; |
| 28 |
|
| 29 |
private $_query = null; |
| 30 |
|
| 31 |
public function get_name() |
| 32 |
{ |
| 33 |
return 'upk-alter-carousel'; |
| 34 |
} |
| 35 |
|
| 36 |
public function get_title() |
| 37 |
{ |
| 38 |
return BDTUPK . esc_html__('Alter Carousel', 'ultimate-post-kit'); |
| 39 |
} |
| 40 |
|
| 41 |
public function get_icon() |
| 42 |
{ |
| 43 |
return 'upk-widget-icon upk-icon-alter-carousel'; |
| 44 |
} |
| 45 |
|
| 46 |
public function get_categories() |
| 47 |
{ |
| 48 |
return ['ultimate-post-kit']; |
| 49 |
} |
| 50 |
|
| 51 |
public function get_keywords() |
| 52 |
{ |
| 53 |
return ['post', 'carousel', 'blog', 'recent', 'news', 'alter']; |
| 54 |
} |
| 55 |
|
| 56 |
public function get_style_depends() |
| 57 |
{ |
| 58 |
if ($this->upk_is_edit_mode()) { |
| 59 |
return ['swiper', 'upk-all-styles']; |
| 60 |
} else { |
| 61 |
return ['swiper', 'upk-font', 'upk-alter-carousel']; |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
public function get_script_depends() |
| 66 |
{ |
| 67 |
if ($this->upk_is_edit_mode()) { |
| 68 |
return ['swiper', 'upk-all-scripts']; |
| 69 |
} else { |
| 70 |
return ['swiper', 'upk-alter-carousel']; |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
public function get_custom_help_url() |
| 75 |
{ |
| 76 |
return 'https://youtu.be/KInlL05e_lk'; |
| 77 |
} |
| 78 |
|
| 79 |
public function get_query() |
| 80 |
{ |
| 81 |
return $this->_query; |
| 82 |
} |
| 83 |
|
| 84 |
public function has_widget_inner_wrapper(): bool { |
| 85 |
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
protected function register_controls() { |
| 90 |
$this->start_controls_section( |
| 91 |
'section_content_layout', |
| 92 |
[ |
| 93 |
'label' => esc_html__('Layout', 'ultimate-post-kit'), |
| 94 |
] |
| 95 |
); |
| 96 |
|
| 97 |
$this->add_responsive_control( |
| 98 |
'columns', |
| 99 |
[ |
| 100 |
'label' => esc_html__('Columns', 'ultimate-post-kit'), |
| 101 |
'type' => Controls_Manager::SELECT, |
| 102 |
'default' => 3, |
| 103 |
'tablet_default' => 2, |
| 104 |
'mobile_default' => 1, |
| 105 |
'options' => [ |
| 106 |
1 => esc_html__('1', 'ultimate-post-kit'), |
| 107 |
2 => esc_html__('2', 'ultimate-post-kit'), |
| 108 |
3 => esc_html__('3', 'ultimate-post-kit'), |
| 109 |
4 => esc_html__('4', 'ultimate-post-kit'), |
| 110 |
5 => esc_html__('5', 'ultimate-post-kit'), |
| 111 |
6 => esc_html__('6', 'ultimate-post-kit'), |
| 112 |
], |
| 113 |
] |
| 114 |
); |
| 115 |
|
| 116 |
$this->add_responsive_control( |
| 117 |
'item_gap', |
| 118 |
[ |
| 119 |
'label' => esc_html__('Item Gap', 'ultimate-post-kit'), |
| 120 |
'type' => Controls_Manager::SLIDER, |
| 121 |
'default' => [ |
| 122 |
'size' => 20, |
| 123 |
], |
| 124 |
'tablet_default' => [ |
| 125 |
'size' => 20, |
| 126 |
], |
| 127 |
'mobile_default' => [ |
| 128 |
'size' => 20, |
| 129 |
], |
| 130 |
'range' => [ |
| 131 |
'px' => [ |
| 132 |
'min' => 0, |
| 133 |
'max' => 100, |
| 134 |
], |
| 135 |
], |
| 136 |
] |
| 137 |
); |
| 138 |
|
| 139 |
$this->add_group_control( |
| 140 |
Group_Control_Image_Size::get_type(), |
| 141 |
[ |
| 142 |
'name' => 'primary_thumbnail', |
| 143 |
'exclude' => ['custom'], |
| 144 |
'default' => 'medium', |
| 145 |
] |
| 146 |
); |
| 147 |
|
| 148 |
$this->add_responsive_control( |
| 149 |
'default_image_height', |
| 150 |
[ |
| 151 |
'label' => esc_html__('Image Height(px)', 'ultimate-post-kit'), |
| 152 |
'type' => Controls_Manager::SLIDER, |
| 153 |
'range' => [ |
| 154 |
'px' => [ |
| 155 |
'min' => 100, |
| 156 |
'max' => 500, |
| 157 |
], |
| 158 |
], |
| 159 |
'selectors' => [ |
| 160 |
'{{WRAPPER}} .upk-alter-carousel .upk-img-wrap .upk-main-img' => 'height: {{SIZE}}px;', |
| 161 |
], |
| 162 |
] |
| 163 |
); |
| 164 |
|
| 165 |
$this->end_controls_section(); |
| 166 |
|
| 167 |
// Query Settings |
| 168 |
$this->start_controls_section( |
| 169 |
'section_post_query_builder', |
| 170 |
[ |
| 171 |
'label' => esc_html__('Query', 'ultimate-post-kit'), |
| 172 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 173 |
] |
| 174 |
); |
| 175 |
|
| 176 |
$this->add_control( |
| 177 |
'item_limit', |
| 178 |
[ |
| 179 |
'label' => esc_html__('Item Limit', 'ultimate-post-kit'), |
| 180 |
'type' => Controls_Manager::SLIDER, |
| 181 |
'range' => [ |
| 182 |
'px' => [ |
| 183 |
'min' => 1, |
| 184 |
'max' => 20, |
| 185 |
], |
| 186 |
], |
| 187 |
'default' => [ |
| 188 |
'size' => 6, |
| 189 |
], |
| 190 |
'condition' => [ |
| 191 |
'posts_source!' => 'current_query', |
| 192 |
] |
| 193 |
] |
| 194 |
); |
| 195 |
|
| 196 |
$this->register_query_builder_controls(); |
| 197 |
|
| 198 |
$this->end_controls_section(); |
| 199 |
|
| 200 |
$this->start_controls_section( |
| 201 |
'section_content_additional', |
| 202 |
[ |
| 203 |
'label' => esc_html__('Additional Options', 'ultimate-post-kit'), |
| 204 |
] |
| 205 |
); |
| 206 |
|
| 207 |
//Global Title Controls |
| 208 |
$this->register_title_controls(); |
| 209 |
$this->register_text_controls(); |
| 210 |
|
| 211 |
$this->add_control( |
| 212 |
'show_author', |
| 213 |
[ |
| 214 |
'label' => esc_html__('Show Author', 'ultimate-post-kit'), |
| 215 |
'type' => Controls_Manager::SWITCHER, |
| 216 |
'default' => 'yes', |
| 217 |
'separator' => 'before' |
| 218 |
] |
| 219 |
); |
| 220 |
|
| 221 |
$this->add_control( |
| 222 |
'meta_separator', |
| 223 |
[ |
| 224 |
'label' => esc_html__('Separator', 'ultimate-post-kit'), |
| 225 |
'type' => Controls_Manager::TEXT, |
| 226 |
'default' => '|', |
| 227 |
'label_block' => false, |
| 228 |
] |
| 229 |
); |
| 230 |
|
| 231 |
//Global Date Controls |
| 232 |
$this->register_date_controls(); |
| 233 |
|
| 234 |
//Global Reading Time Controls |
| 235 |
$this->register_reading_time_controls(); |
| 236 |
|
| 237 |
$this->add_control( |
| 238 |
'show_category', |
| 239 |
[ |
| 240 |
'label' => esc_html__('Show Category', 'ultimate-post-kit'), |
| 241 |
'type' => Controls_Manager::SWITCHER, |
| 242 |
'default' => 'yes', |
| 243 |
'separator' => 'before' |
| 244 |
] |
| 245 |
); |
| 246 |
|
| 247 |
$this->add_control( |
| 248 |
'readmore_type', |
| 249 |
[ |
| 250 |
'label' => esc_html__('Read More Type', 'ultimate-post-kit') . BDTUPK_PC, |
| 251 |
'type' => Controls_Manager::SELECT, |
| 252 |
'default' => 'none', |
| 253 |
'options' => [ |
| 254 |
'none' => esc_html__('None', 'ultimate-post-kit'), |
| 255 |
'classic' => esc_html__('Classic', 'ultimate-post-kit'), |
| 256 |
'on_image' => esc_html__('On Image', 'ultimate-post-kit'), |
| 257 |
], |
| 258 |
'separator' => 'before', |
| 259 |
'classes' => BDTUPK_IS_PC |
| 260 |
] |
| 261 |
); |
| 262 |
|
| 263 |
$this->add_control( |
| 264 |
'item_match_height', |
| 265 |
[ |
| 266 |
'label' => esc_html__('Item Match Height', 'ultimate-post-kit'), |
| 267 |
'type' => Controls_Manager::SWITCHER, |
| 268 |
'default' => 'yes', |
| 269 |
'prefix_class' => 'upk-item-match-height--', |
| 270 |
'separator' => 'before', |
| 271 |
'render_type' => 'template' |
| 272 |
] |
| 273 |
); |
| 274 |
|
| 275 |
$this->add_control( |
| 276 |
'meta_end_position', |
| 277 |
[ |
| 278 |
'label' => esc_html__('Meta End Position', 'ultimate-post-kit'), |
| 279 |
'type' => Controls_Manager::SWITCHER, |
| 280 |
'prefix_class' => 'upk-meta-end-position--', |
| 281 |
'condition' => [ |
| 282 |
'item_match_height' => 'yes' |
| 283 |
] |
| 284 |
] |
| 285 |
); |
| 286 |
|
| 287 |
$this->add_control( |
| 288 |
'show_post_format', |
| 289 |
[ |
| 290 |
'label' => esc_html__('Post Format', 'ultimate-post-kit'), |
| 291 |
'type' => Controls_Manager::SWITCHER, |
| 292 |
'separator' => 'before' |
| 293 |
] |
| 294 |
); |
| 295 |
|
| 296 |
$this->add_control( |
| 297 |
'global_link', |
| 298 |
[ |
| 299 |
'label' => esc_html__('Item Wrapper Link', 'ultimate-post-kit'), |
| 300 |
'type' => Controls_Manager::SWITCHER, |
| 301 |
'prefix_class' => 'upk-global-link-', |
| 302 |
'description' => esc_html__('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'), |
| 303 |
'separator' => 'before', |
| 304 |
] |
| 305 |
); |
| 306 |
|
| 307 |
$this->end_controls_section(); |
| 308 |
|
| 309 |
$this->start_controls_section( |
| 310 |
'section_content_readmore', |
| 311 |
[ |
| 312 |
'label' => esc_html__('Read More', 'ultimate-post-kit'), |
| 313 |
'condition' => [ |
| 314 |
'readmore_type' => 'classic', |
| 315 |
], |
| 316 |
] |
| 317 |
); |
| 318 |
|
| 319 |
$this->add_control( |
| 320 |
'readmore_text', |
| 321 |
[ |
| 322 |
'label' => esc_html__('Read More Text', 'ultimate-post-kit'), |
| 323 |
'type' => Controls_Manager::TEXT, |
| 324 |
'dynamic' => [ 'active' => true ], |
| 325 |
'default' => esc_html__('Read More', 'ultimate-post-kit'), |
| 326 |
'placeholder' => esc_html__('Read More', 'ultimate-post-kit'), |
| 327 |
] |
| 328 |
); |
| 329 |
|
| 330 |
$this->add_control( |
| 331 |
'readmore_icon', |
| 332 |
[ |
| 333 |
'label' => esc_html__('Icon', 'ultimate-post-kit'), |
| 334 |
'type' => Controls_Manager::ICONS, |
| 335 |
'label_block' => false, |
| 336 |
'skin' => 'inline' |
| 337 |
] |
| 338 |
); |
| 339 |
|
| 340 |
$this->add_control( |
| 341 |
'readmore_icon_align', |
| 342 |
[ |
| 343 |
'label' => esc_html__('Icon Position', 'ultimate-post-kit'), |
| 344 |
'type' => Controls_Manager::CHOOSE, |
| 345 |
'default' => 'right', |
| 346 |
'toggle' => false, |
| 347 |
'options' => [ |
| 348 |
'left' => [ |
| 349 |
'title' => esc_html__('Left', 'ultimate-post-kit'), |
| 350 |
'icon' => 'eicon-h-align-left', |
| 351 |
], |
| 352 |
'right' => [ |
| 353 |
'title' => esc_html__('Right', 'ultimate-post-kit'), |
| 354 |
'icon' => 'eicon-h-align-right', |
| 355 |
], |
| 356 |
], |
| 357 |
'condition' => [ |
| 358 |
'readmore_icon[value]!' => '', |
| 359 |
], |
| 360 |
] |
| 361 |
); |
| 362 |
|
| 363 |
$this->add_responsive_control( |
| 364 |
'readmore_icon_indent', |
| 365 |
[ |
| 366 |
'label' => esc_html__('Icon Spacing', 'ultimate-post-kit'), |
| 367 |
'type' => Controls_Manager::SLIDER, |
| 368 |
'default' => [ |
| 369 |
'size' => 8, |
| 370 |
], |
| 371 |
'range' => [ |
| 372 |
'px' => [ |
| 373 |
'max' => 50, |
| 374 |
], |
| 375 |
], |
| 376 |
'condition' => [ |
| 377 |
'readmore_icon[value]!' => '', |
| 378 |
], |
| 379 |
'selectors' => [ |
| 380 |
'{{WRAPPER}} .upk-alter-carousel .upk-button-icon-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};', |
| 381 |
'{{WRAPPER}} .upk-alter-carousel .upk-button-icon-align-left' => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};', |
| 382 |
], |
| 383 |
] |
| 384 |
); |
| 385 |
|
| 386 |
$this->end_controls_section(); |
| 387 |
|
| 388 |
//Navigaiton Global Controls |
| 389 |
$this->register_navigation_controls('alter'); |
| 390 |
|
| 391 |
//Style |
| 392 |
$this->start_controls_section( |
| 393 |
'upk_section_style', |
| 394 |
[ |
| 395 |
'label' => esc_html__('Items', 'ultimate-post-kit'), |
| 396 |
'tab' => Controls_Manager::TAB_STYLE, |
| 397 |
] |
| 398 |
); |
| 399 |
|
| 400 |
$this->add_responsive_control( |
| 401 |
'content_padding', |
| 402 |
[ |
| 403 |
'label' => esc_html__('Content Padding', 'ultimate-post-kit'), |
| 404 |
'type' => Controls_Manager::DIMENSIONS, |
| 405 |
'size_units' => ['px', 'em', '%'], |
| 406 |
'selectors' => [ |
| 407 |
'{{WRAPPER}} .upk-alter-carousel .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 408 |
], |
| 409 |
] |
| 410 |
); |
| 411 |
|
| 412 |
$this->start_controls_tabs('tabs_item_style'); |
| 413 |
|
| 414 |
$this->start_controls_tab( |
| 415 |
'tab_item_normal', |
| 416 |
[ |
| 417 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 418 |
] |
| 419 |
); |
| 420 |
|
| 421 |
$this->add_group_control( |
| 422 |
Group_Control_Background::get_type(), |
| 423 |
[ |
| 424 |
'name' => 'itam_background', |
| 425 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-item', |
| 426 |
] |
| 427 |
); |
| 428 |
|
| 429 |
$this->add_group_control( |
| 430 |
Group_Control_Border::get_type(), |
| 431 |
[ |
| 432 |
'name' => 'item_border', |
| 433 |
'label' => esc_html__('Border', 'ultimate-post-kit'), |
| 434 |
'placeholder' => '1px', |
| 435 |
'default' => '1px', |
| 436 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-item', |
| 437 |
] |
| 438 |
); |
| 439 |
|
| 440 |
$this->add_responsive_control( |
| 441 |
'item_border_radius', |
| 442 |
[ |
| 443 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 444 |
'type' => Controls_Manager::DIMENSIONS, |
| 445 |
'size_units' => ['px', '%'], |
| 446 |
'selectors' => [ |
| 447 |
'{{WRAPPER}} .upk-alter-carousel .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 448 |
], |
| 449 |
] |
| 450 |
); |
| 451 |
|
| 452 |
$this->add_group_control( |
| 453 |
Group_Control_Box_Shadow::get_type(), |
| 454 |
[ |
| 455 |
'name' => 'item_box_shadow', |
| 456 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-item', |
| 457 |
] |
| 458 |
); |
| 459 |
|
| 460 |
$this->end_controls_tab(); |
| 461 |
|
| 462 |
$this->start_controls_tab( |
| 463 |
'tab_item_hover', |
| 464 |
[ |
| 465 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 466 |
] |
| 467 |
); |
| 468 |
|
| 469 |
$this->add_group_control( |
| 470 |
Group_Control_Background::get_type(), |
| 471 |
[ |
| 472 |
'name' => 'itam_background_hover', |
| 473 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-item:hover', |
| 474 |
] |
| 475 |
); |
| 476 |
|
| 477 |
$this->add_control( |
| 478 |
'item_border_color_hover', |
| 479 |
[ |
| 480 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 481 |
'type' => Controls_Manager::COLOR, |
| 482 |
'selectors' => [ |
| 483 |
'{{WRAPPER}} .upk-alter-carousel .upk-item:hover' => 'border-color: {{VALUE}};' |
| 484 |
], |
| 485 |
'condition' => [ |
| 486 |
'item_border_border!' => '' |
| 487 |
] |
| 488 |
] |
| 489 |
); |
| 490 |
|
| 491 |
$this->add_group_control( |
| 492 |
Group_Control_Box_Shadow::get_type(), |
| 493 |
[ |
| 494 |
'name' => 'item_box_shadow_hover', |
| 495 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-item:hover', |
| 496 |
] |
| 497 |
); |
| 498 |
|
| 499 |
$this->add_responsive_control( |
| 500 |
'item_shadow_padding', |
| 501 |
[ |
| 502 |
'label' => esc_html__('Match Padding', 'ultimate-post-kit'), |
| 503 |
'description' => esc_html__('You have to add padding for matching overlaping normal/hover box shadow when you used Box Shadow option.', 'ultimate-post-kit'), |
| 504 |
'type' => Controls_Manager::SLIDER, |
| 505 |
'range' => [ |
| 506 |
'px' => [ |
| 507 |
'min' => 0, |
| 508 |
'step' => 1, |
| 509 |
'max' => 50, |
| 510 |
] |
| 511 |
], |
| 512 |
'selectors' => [ |
| 513 |
'{{WRAPPER}} .swiper-carousel' => 'padding: {{SIZE}}{{UNIT}}; margin: 0 -{{SIZE}}{{UNIT}};' |
| 514 |
], |
| 515 |
] |
| 516 |
); |
| 517 |
|
| 518 |
$this->end_controls_tab(); |
| 519 |
|
| 520 |
$this->end_controls_tabs(); |
| 521 |
|
| 522 |
$this->end_controls_section(); |
| 523 |
|
| 524 |
$this->start_controls_section( |
| 525 |
'section_style_title', |
| 526 |
[ |
| 527 |
'label' => esc_html__('Title', 'ultimate-post-kit'), |
| 528 |
'tab' => Controls_Manager::TAB_STYLE, |
| 529 |
'condition' => [ |
| 530 |
'show_title' => 'yes', |
| 531 |
], |
| 532 |
] |
| 533 |
); |
| 534 |
|
| 535 |
$this->add_control( |
| 536 |
'title_style', |
| 537 |
[ |
| 538 |
'label' => esc_html__('Style', 'ultimate-post-kit'), |
| 539 |
'type' => Controls_Manager::SELECT, |
| 540 |
'default' => 'underline', |
| 541 |
'options' => [ |
| 542 |
'underline' => esc_html__('Underline', 'ultimate-post-kit'), |
| 543 |
'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'), |
| 544 |
'overline' => esc_html__('Overline', 'ultimate-post-kit'), |
| 545 |
'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'), |
| 546 |
], |
| 547 |
] |
| 548 |
); |
| 549 |
|
| 550 |
$this->add_control( |
| 551 |
'title_color', |
| 552 |
[ |
| 553 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 554 |
'type' => Controls_Manager::COLOR, |
| 555 |
'selectors' => [ |
| 556 |
'{{WRAPPER}} .upk-alter-carousel .upk-title a' => 'color: {{VALUE}};', |
| 557 |
], |
| 558 |
] |
| 559 |
); |
| 560 |
|
| 561 |
$this->add_control( |
| 562 |
'title_hover_color', |
| 563 |
[ |
| 564 |
'label' => esc_html__('Hover Color', 'ultimate-post-kit'), |
| 565 |
'type' => Controls_Manager::COLOR, |
| 566 |
'selectors' => [ |
| 567 |
'{{WRAPPER}} .upk-alter-carousel .upk-title a:hover' => 'color: {{VALUE}};', |
| 568 |
], |
| 569 |
] |
| 570 |
); |
| 571 |
|
| 572 |
$this->add_responsive_control( |
| 573 |
'title_spacing', |
| 574 |
[ |
| 575 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 576 |
'type' => Controls_Manager::SLIDER, |
| 577 |
'range' => [ |
| 578 |
'px' => [ |
| 579 |
'min' => 0, |
| 580 |
'max' => 50, |
| 581 |
], |
| 582 |
], |
| 583 |
'selectors' => [ |
| 584 |
'{{WRAPPER}} .upk-alter-carousel .upk-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 585 |
], |
| 586 |
] |
| 587 |
); |
| 588 |
|
| 589 |
$this->add_group_control( |
| 590 |
Group_Control_Typography::get_type(), |
| 591 |
[ |
| 592 |
'name' => 'title_typography', |
| 593 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 594 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-title a', |
| 595 |
] |
| 596 |
); |
| 597 |
|
| 598 |
$this->add_control( |
| 599 |
'title_advanced_style', |
| 600 |
[ |
| 601 |
'label' => esc_html__('Advanced Style', 'ultimate-post-kit'), |
| 602 |
'type' => Controls_Manager::SWITCHER, |
| 603 |
] |
| 604 |
); |
| 605 |
|
| 606 |
$this->add_control( |
| 607 |
'title_background', |
| 608 |
[ |
| 609 |
'label' => esc_html__('Background Color', 'ultimate-post-kit'), |
| 610 |
'type' => Controls_Manager::COLOR, |
| 611 |
'selectors' => [ |
| 612 |
'{{WRAPPER}} .upk-alter-carousel .upk-title a' => 'background-color: {{VALUE}};', |
| 613 |
], |
| 614 |
'condition' => [ |
| 615 |
'title_advanced_style' => 'yes' |
| 616 |
] |
| 617 |
] |
| 618 |
); |
| 619 |
|
| 620 |
$this->add_group_control( |
| 621 |
Group_Control_Text_Shadow::get_type(), |
| 622 |
[ |
| 623 |
'name' => 'title_text_shadow', |
| 624 |
'label' => esc_html__('Text Shadow', 'ultimate-post-kit'), |
| 625 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-title a', |
| 626 |
'condition' => [ |
| 627 |
'title_advanced_style' => 'yes' |
| 628 |
] |
| 629 |
] |
| 630 |
); |
| 631 |
|
| 632 |
$this->add_group_control( |
| 633 |
Group_Control_Border::get_type(), |
| 634 |
[ |
| 635 |
'name' => 'title_border', |
| 636 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-title a', |
| 637 |
'condition' => [ |
| 638 |
'title_advanced_style' => 'yes' |
| 639 |
] |
| 640 |
] |
| 641 |
); |
| 642 |
|
| 643 |
$this->add_responsive_control( |
| 644 |
'title_border_radius', |
| 645 |
[ |
| 646 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 647 |
'type' => Controls_Manager::DIMENSIONS, |
| 648 |
'size_units' => ['px', '%'], |
| 649 |
'selectors' => [ |
| 650 |
'{{WRAPPER}} .upk-alter-carousel .upk-title a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 651 |
], |
| 652 |
'condition' => [ |
| 653 |
'title_advanced_style' => 'yes' |
| 654 |
] |
| 655 |
] |
| 656 |
); |
| 657 |
|
| 658 |
$this->add_group_control( |
| 659 |
Group_Control_Box_Shadow::get_type(), |
| 660 |
[ |
| 661 |
'name' => 'title_box_shadow', |
| 662 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-title a', |
| 663 |
'condition' => [ |
| 664 |
'title_advanced_style' => 'yes' |
| 665 |
] |
| 666 |
] |
| 667 |
); |
| 668 |
|
| 669 |
$this->add_responsive_control( |
| 670 |
'title_text_padding', |
| 671 |
[ |
| 672 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 673 |
'type' => Controls_Manager::DIMENSIONS, |
| 674 |
'size_units' => ['px', 'em', '%'], |
| 675 |
'selectors' => [ |
| 676 |
'{{WRAPPER}} .upk-alter-carousel .upk-title a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 677 |
], |
| 678 |
'condition' => [ |
| 679 |
'title_advanced_style' => 'yes' |
| 680 |
] |
| 681 |
] |
| 682 |
); |
| 683 |
|
| 684 |
$this->end_controls_section(); |
| 685 |
|
| 686 |
$this->start_controls_section( |
| 687 |
'section_style_text', |
| 688 |
[ |
| 689 |
'label' => esc_html__('Text', 'ultimate-post-kit'), |
| 690 |
'tab' => Controls_Manager::TAB_STYLE, |
| 691 |
'condition' => [ |
| 692 |
'show_excerpt' => 'yes', |
| 693 |
], |
| 694 |
] |
| 695 |
); |
| 696 |
|
| 697 |
$this->add_control( |
| 698 |
'text_color', |
| 699 |
[ |
| 700 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 701 |
'type' => Controls_Manager::COLOR, |
| 702 |
'selectors' => [ |
| 703 |
'{{WRAPPER}} .upk-alter-carousel .upk-text' => 'color: {{VALUE}};', |
| 704 |
], |
| 705 |
] |
| 706 |
); |
| 707 |
|
| 708 |
$this->add_group_control( |
| 709 |
Group_Control_Typography::get_type(), |
| 710 |
[ |
| 711 |
'name' => 'text_typography', |
| 712 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 713 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-text', |
| 714 |
] |
| 715 |
); |
| 716 |
|
| 717 |
$this->add_responsive_control( |
| 718 |
'text_margin', |
| 719 |
[ |
| 720 |
'label' => esc_html__('Margin', 'ultimate-post-kit'), |
| 721 |
'type' => Controls_Manager::DIMENSIONS, |
| 722 |
'size_units' => ['px', 'em', '%'], |
| 723 |
'selectors' => [ |
| 724 |
'{{WRAPPER}} .upk-alter-carousel .upk-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 725 |
] |
| 726 |
] |
| 727 |
); |
| 728 |
|
| 729 |
$this->end_controls_section(); |
| 730 |
|
| 731 |
$this->start_controls_section( |
| 732 |
'section_style_author', |
| 733 |
[ |
| 734 |
'label' => esc_html__('Meta', 'ultimate-post-kit'), |
| 735 |
'tab' => Controls_Manager::TAB_STYLE, |
| 736 |
'conditions' => [ |
| 737 |
'relation' => 'or', |
| 738 |
'terms' => [ |
| 739 |
[ |
| 740 |
'name' => 'show_author', |
| 741 |
'value' => 'yes' |
| 742 |
], |
| 743 |
[ |
| 744 |
'name' => 'show_date', |
| 745 |
'value' => 'yes' |
| 746 |
] |
| 747 |
] |
| 748 |
], |
| 749 |
] |
| 750 |
); |
| 751 |
|
| 752 |
$this->add_control( |
| 753 |
'author_color', |
| 754 |
[ |
| 755 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 756 |
'type' => Controls_Manager::COLOR, |
| 757 |
'selectors' => [ |
| 758 |
'{{WRAPPER}} .upk-alter-carousel .upk-meta .upk-blog-author a, {{WRAPPER}} .upk-alter-carousel .upk-meta' => 'color: {{VALUE}};', |
| 759 |
], |
| 760 |
] |
| 761 |
); |
| 762 |
|
| 763 |
$this->add_control( |
| 764 |
'author_hover_color', |
| 765 |
[ |
| 766 |
'label' => esc_html__('Hover Color', 'ultimate-post-kit'), |
| 767 |
'type' => Controls_Manager::COLOR, |
| 768 |
'selectors' => [ |
| 769 |
'{{WRAPPER}} .upk-alter-carousel .upk-meta .upk-blog-author a:hover' => 'color: {{VALUE}};', |
| 770 |
], |
| 771 |
] |
| 772 |
); |
| 773 |
|
| 774 |
$this->add_responsive_control( |
| 775 |
'meta_spacing', |
| 776 |
[ |
| 777 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 778 |
'type' => Controls_Manager::SLIDER, |
| 779 |
'range' => [ |
| 780 |
'px' => [ |
| 781 |
'min' => 0, |
| 782 |
'max' => 50, |
| 783 |
], |
| 784 |
], |
| 785 |
'selectors' => [ |
| 786 |
'{{WRAPPER}} .upk-alter-carousel .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};', |
| 787 |
], |
| 788 |
] |
| 789 |
); |
| 790 |
|
| 791 |
$this->add_group_control( |
| 792 |
Group_Control_Typography::get_type(), |
| 793 |
[ |
| 794 |
'name' => 'author_typography', |
| 795 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 796 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-meta', |
| 797 |
] |
| 798 |
); |
| 799 |
|
| 800 |
$this->end_controls_section(); |
| 801 |
|
| 802 |
$this->start_controls_section( |
| 803 |
'section_style_category', |
| 804 |
[ |
| 805 |
'label' => esc_html__('Category', 'ultimate-post-kit'), |
| 806 |
'tab' => Controls_Manager::TAB_STYLE, |
| 807 |
'condition' => [ |
| 808 |
'show_category' => 'yes', |
| 809 |
], |
| 810 |
] |
| 811 |
); |
| 812 |
|
| 813 |
$this->add_responsive_control( |
| 814 |
'category_spacing', |
| 815 |
[ |
| 816 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 817 |
'type' => Controls_Manager::SLIDER, |
| 818 |
'range' => [ |
| 819 |
'px' => [ |
| 820 |
'min' => 0, |
| 821 |
'max' => 50, |
| 822 |
], |
| 823 |
], |
| 824 |
'selectors' => [ |
| 825 |
'{{WRAPPER}} .upk-alter-carousel .upk-category' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 826 |
], |
| 827 |
] |
| 828 |
); |
| 829 |
|
| 830 |
$this->start_controls_tabs('tabs_category_style'); |
| 831 |
|
| 832 |
$this->start_controls_tab( |
| 833 |
'tab_category_normal', |
| 834 |
[ |
| 835 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 836 |
] |
| 837 |
); |
| 838 |
|
| 839 |
$this->add_control( |
| 840 |
'category_color', |
| 841 |
[ |
| 842 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 843 |
'type' => Controls_Manager::COLOR, |
| 844 |
'selectors' => [ |
| 845 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a' => 'color: {{VALUE}};', |
| 846 |
], |
| 847 |
] |
| 848 |
); |
| 849 |
|
| 850 |
$this->add_group_control( |
| 851 |
Group_Control_Background::get_type(), |
| 852 |
[ |
| 853 |
'name' => 'category_background', |
| 854 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-category a', |
| 855 |
] |
| 856 |
); |
| 857 |
|
| 858 |
$this->add_group_control( |
| 859 |
Group_Control_Border::get_type(), |
| 860 |
[ |
| 861 |
'name' => 'category_border', |
| 862 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-category a', |
| 863 |
] |
| 864 |
); |
| 865 |
|
| 866 |
$this->add_responsive_control( |
| 867 |
'category_border_radius', |
| 868 |
[ |
| 869 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 870 |
'type' => Controls_Manager::DIMENSIONS, |
| 871 |
'size_units' => ['px', '%'], |
| 872 |
'selectors' => [ |
| 873 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 874 |
], |
| 875 |
] |
| 876 |
); |
| 877 |
|
| 878 |
$this->add_responsive_control( |
| 879 |
'category_padding', |
| 880 |
[ |
| 881 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 882 |
'type' => Controls_Manager::DIMENSIONS, |
| 883 |
'size_units' => ['px', 'em', '%'], |
| 884 |
'selectors' => [ |
| 885 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 886 |
], |
| 887 |
] |
| 888 |
); |
| 889 |
|
| 890 |
$this->add_responsive_control( |
| 891 |
'category_margin', |
| 892 |
[ |
| 893 |
'label' => esc_html__('Margin', 'ultimate-post-kit'), |
| 894 |
'type' => Controls_Manager::DIMENSIONS, |
| 895 |
'size_units' => ['px', 'em', '%'], |
| 896 |
'selectors' => [ |
| 897 |
'{{WRAPPER}} .upk-alter-carousel .upk-category' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 898 |
], |
| 899 |
] |
| 900 |
); |
| 901 |
|
| 902 |
$this->add_responsive_control( |
| 903 |
'category_spacing_between', |
| 904 |
[ |
| 905 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 906 |
'type' => Controls_Manager::SLIDER, |
| 907 |
'range' => [ |
| 908 |
'px' => [ |
| 909 |
'min' => 0, |
| 910 |
'max' => 50, |
| 911 |
], |
| 912 |
], |
| 913 |
'selectors' => [ |
| 914 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 915 |
], |
| 916 |
] |
| 917 |
); |
| 918 |
|
| 919 |
|
| 920 |
$this->add_group_control( |
| 921 |
Group_Control_Box_Shadow::get_type(), |
| 922 |
[ |
| 923 |
'name' => 'category_shadow', |
| 924 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-category a', |
| 925 |
] |
| 926 |
); |
| 927 |
|
| 928 |
$this->add_group_control( |
| 929 |
Group_Control_Typography::get_type(), |
| 930 |
[ |
| 931 |
'name' => 'category_typography', |
| 932 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 933 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-category a', |
| 934 |
] |
| 935 |
); |
| 936 |
|
| 937 |
$this->end_controls_tab(); |
| 938 |
|
| 939 |
$this->start_controls_tab( |
| 940 |
'tab_category_hover', |
| 941 |
[ |
| 942 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 943 |
] |
| 944 |
); |
| 945 |
|
| 946 |
$this->add_control( |
| 947 |
'category_hover_color', |
| 948 |
[ |
| 949 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 950 |
'type' => Controls_Manager::COLOR, |
| 951 |
'selectors' => [ |
| 952 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a:hover' => 'color: {{VALUE}};', |
| 953 |
], |
| 954 |
] |
| 955 |
); |
| 956 |
|
| 957 |
$this->add_group_control( |
| 958 |
Group_Control_Background::get_type(), |
| 959 |
[ |
| 960 |
'name' => 'category_hover_background', |
| 961 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-category a:hover', |
| 962 |
] |
| 963 |
); |
| 964 |
|
| 965 |
$this->add_control( |
| 966 |
'category_hover_border_color', |
| 967 |
[ |
| 968 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 969 |
'type' => Controls_Manager::COLOR, |
| 970 |
'condition' => [ |
| 971 |
'category_border_border!' => '', |
| 972 |
], |
| 973 |
'selectors' => [ |
| 974 |
'{{WRAPPER}} .upk-alter-carousel .upk-category a:hover' => 'border-color: {{VALUE}};', |
| 975 |
], |
| 976 |
] |
| 977 |
); |
| 978 |
|
| 979 |
$this->end_controls_tab(); |
| 980 |
|
| 981 |
$this->end_controls_tabs(); |
| 982 |
|
| 983 |
$this->end_controls_section(); |
| 984 |
|
| 985 |
$this->start_controls_section( |
| 986 |
'section_style_post_format', |
| 987 |
[ |
| 988 |
'label' => esc_html__('Post Format', 'ultimate-post-kit'), |
| 989 |
'tab' => Controls_Manager::TAB_STYLE, |
| 990 |
'condition' => [ |
| 991 |
'show_post_format' => 'yes', |
| 992 |
], |
| 993 |
] |
| 994 |
); |
| 995 |
|
| 996 |
$this->start_controls_tabs('tabs_post_format_style'); |
| 997 |
|
| 998 |
$this->start_controls_tab( |
| 999 |
'tab_post_format_normal', |
| 1000 |
[ |
| 1001 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 1002 |
] |
| 1003 |
); |
| 1004 |
|
| 1005 |
$this->add_control( |
| 1006 |
'post_format_color', |
| 1007 |
[ |
| 1008 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1009 |
'type' => Controls_Manager::COLOR, |
| 1010 |
'selectors' => [ |
| 1011 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a' => 'color: {{VALUE}};', |
| 1012 |
], |
| 1013 |
] |
| 1014 |
); |
| 1015 |
|
| 1016 |
$this->add_group_control( |
| 1017 |
Group_Control_Background::get_type(), |
| 1018 |
[ |
| 1019 |
'name' => 'post_format_background', |
| 1020 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-post-format a', |
| 1021 |
] |
| 1022 |
); |
| 1023 |
|
| 1024 |
$this->add_group_control( |
| 1025 |
Group_Control_Border::get_type(), |
| 1026 |
[ |
| 1027 |
'name' => 'post_format_border', |
| 1028 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-post-format a', |
| 1029 |
] |
| 1030 |
); |
| 1031 |
|
| 1032 |
$this->add_responsive_control( |
| 1033 |
'post_format_border_radius', |
| 1034 |
[ |
| 1035 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 1036 |
'type' => Controls_Manager::DIMENSIONS, |
| 1037 |
'size_units' => ['px', '%'], |
| 1038 |
'selectors' => [ |
| 1039 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1040 |
], |
| 1041 |
] |
| 1042 |
); |
| 1043 |
|
| 1044 |
$this->add_responsive_control( |
| 1045 |
'post_format_padding', |
| 1046 |
[ |
| 1047 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 1048 |
'type' => Controls_Manager::DIMENSIONS, |
| 1049 |
'size_units' => ['px', 'em', '%'], |
| 1050 |
'selectors' => [ |
| 1051 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1052 |
], |
| 1053 |
] |
| 1054 |
); |
| 1055 |
|
| 1056 |
$this->add_responsive_control( |
| 1057 |
'post_format_margin', |
| 1058 |
[ |
| 1059 |
'label' => esc_html__('Margin', 'ultimate-post-kit'), |
| 1060 |
'type' => Controls_Manager::DIMENSIONS, |
| 1061 |
'size_units' => ['px', 'em', '%'], |
| 1062 |
'selectors' => [ |
| 1063 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1064 |
], |
| 1065 |
] |
| 1066 |
); |
| 1067 |
|
| 1068 |
$this->add_group_control( |
| 1069 |
Group_Control_Box_Shadow::get_type(), |
| 1070 |
[ |
| 1071 |
'name' => 'post_format_shadow', |
| 1072 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-post-format a', |
| 1073 |
] |
| 1074 |
); |
| 1075 |
|
| 1076 |
$this->add_group_control( |
| 1077 |
Group_Control_Typography::get_type(), |
| 1078 |
[ |
| 1079 |
'name' => 'post_format_typography', |
| 1080 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1081 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-post-format a', |
| 1082 |
] |
| 1083 |
); |
| 1084 |
|
| 1085 |
$this->end_controls_tab(); |
| 1086 |
|
| 1087 |
$this->start_controls_tab( |
| 1088 |
'tab_post_format_hover', |
| 1089 |
[ |
| 1090 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 1091 |
] |
| 1092 |
); |
| 1093 |
|
| 1094 |
$this->add_control( |
| 1095 |
'post_format_hover_color', |
| 1096 |
[ |
| 1097 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1098 |
'type' => Controls_Manager::COLOR, |
| 1099 |
'selectors' => [ |
| 1100 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a:hover' => 'color: {{VALUE}};', |
| 1101 |
], |
| 1102 |
] |
| 1103 |
); |
| 1104 |
|
| 1105 |
$this->add_group_control( |
| 1106 |
Group_Control_Background::get_type(), |
| 1107 |
[ |
| 1108 |
'name' => 'post_format_hover_background', |
| 1109 |
'selector' => '{{WRAPPER}} .upk-alter-carousel .upk-post-format a:hover', |
| 1110 |
] |
| 1111 |
); |
| 1112 |
|
| 1113 |
$this->add_control( |
| 1114 |
'post_format_hover_border_color', |
| 1115 |
[ |
| 1116 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 1117 |
'type' => Controls_Manager::COLOR, |
| 1118 |
'condition' => [ |
| 1119 |
'post_format_border_border!' => '', |
| 1120 |
], |
| 1121 |
'selectors' => [ |
| 1122 |
'{{WRAPPER}} .upk-alter-carousel .upk-post-format a:hover' => 'border-color: {{VALUE}};', |
| 1123 |
], |
| 1124 |
] |
| 1125 |
); |
| 1126 |
|
| 1127 |
$this->end_controls_tab(); |
| 1128 |
|
| 1129 |
$this->end_controls_tabs(); |
| 1130 |
|
| 1131 |
$this->end_controls_section(); |
| 1132 |
|
| 1133 |
//Navigation Global Controls |
| 1134 |
$this->register_navigation_style('swiper'); |
| 1135 |
} |
| 1136 |
|
| 1137 |
/** |
| 1138 |
* Main query render for this widget |
| 1139 |
* @param $posts_per_page number item query limit |
| 1140 |
*/ |
| 1141 |
public function query_posts($posts_per_page) |
| 1142 |
{ |
| 1143 |
|
| 1144 |
$default = $this->getGroupControlQueryArgs(); |
| 1145 |
$args = []; |
| 1146 |
if ($posts_per_page) { |
| 1147 |
$args['posts_per_page'] = $posts_per_page; |
| 1148 |
} |
| 1149 |
$args = array_merge($default, $args); |
| 1150 |
$this->_query = new WP_Query($args); |
| 1151 |
} |
| 1152 |
|
| 1153 |
public function render_header() |
| 1154 |
{ |
| 1155 |
//Global Function |
| 1156 |
$this->render_header_attribute('alter'); |
| 1157 |
|
| 1158 |
?> |
| 1159 |
<div <?php $this->print_render_attribute_string('carousel'); ?>> |
| 1160 |
<div class="upk-post-grid"> |
| 1161 |
<div <?php $this->print_render_attribute_string('swiper'); ?>> |
| 1162 |
<div class="swiper-wrapper"> |
| 1163 |
<?php |
| 1164 |
} |
| 1165 |
|
| 1166 |
public function render_post_grid_item($post_id, $image_size, $excerpt_length) |
| 1167 |
{ |
| 1168 |
$settings = $this->get_settings_for_display(); |
| 1169 |
|
| 1170 |
if ('yes' == $settings['global_link']) { |
| 1171 |
|
| 1172 |
$this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true); |
| 1173 |
} |
| 1174 |
$this->add_render_attribute('grid-item', 'class', 'upk-item swiper-slide', true); |
| 1175 |
|
| 1176 |
?> |
| 1177 |
<div <?php $this->print_render_attribute_string('grid-item'); ?>> |
| 1178 |
<div class="upk-item-box"> |
| 1179 |
<div class="upk-img-wrap"> |
| 1180 |
<div class="upk-main-img"> |
| 1181 |
<?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?> |
| 1182 |
<?php |
| 1183 |
if (_is_upk_pro_activated()) { |
| 1184 |
if ($settings['readmore_type'] == 'on_image') { |
| 1185 |
apply_filters('alter_render_readmore_on_image', ''); |
| 1186 |
} |
| 1187 |
} |
| 1188 |
?> |
| 1189 |
<?php $this->render_post_format(); ?> |
| 1190 |
</div> |
| 1191 |
</div> |
| 1192 |
|
| 1193 |
<div class="upk-content"> |
| 1194 |
<div> |
| 1195 |
<?php $this->render_category(); ?> |
| 1196 |
<?php $this->render_title(substr($this->get_name(), 4)); ?> |
| 1197 |
|
| 1198 |
<div class="upk-text-wrap"> |
| 1199 |
<?php $this->render_excerpt($excerpt_length); ?> |
| 1200 |
<?php |
| 1201 |
if (_is_upk_pro_activated()) { |
| 1202 |
if ($settings['readmore_type'] == 'classic') { |
| 1203 |
apply_filters('alter_render_readmore', $this); |
| 1204 |
} |
| 1205 |
} |
| 1206 |
?> |
| 1207 |
</div> |
| 1208 |
|
| 1209 |
<?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?> |
| 1210 |
<div class="upk-meta"> |
| 1211 |
<?php if ($settings['show_author']) : ?> |
| 1212 |
<div class="upk-blog-author" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1213 |
<a |
| 1214 |
class="author-name" |
| 1215 |
href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>" |
| 1216 |
aria-label="<?php echo esc_attr( 'View all posts by ' . get_the_author() ); ?>" |
| 1217 |
> |
| 1218 |
<?php echo esc_html( get_the_author() ) ?> |
| 1219 |
</a> |
| 1220 |
</div> |
| 1221 |
<?php endif; ?> |
| 1222 |
<?php if ('yes' === $settings['show_date']) : ?> |
| 1223 |
<div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1224 |
<?php $this->render_date(); ?> |
| 1225 |
</div> |
| 1226 |
<?php endif; ?> |
| 1227 |
|
| 1228 |
<?php if (_is_upk_pro_activated()) : |
| 1229 |
if ('yes' === $settings['show_reading_time']) : ?> |
| 1230 |
<div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1231 |
<?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?> |
| 1232 |
</div> |
| 1233 |
<?php endif; ?> |
| 1234 |
<?php endif; ?> |
| 1235 |
</div> |
| 1236 |
<?php endif; ?> |
| 1237 |
|
| 1238 |
</div> |
| 1239 |
</div> |
| 1240 |
</div> |
| 1241 |
</div> |
| 1242 |
<?php |
| 1243 |
} |
| 1244 |
|
| 1245 |
public function render() |
| 1246 |
{ |
| 1247 |
$settings = $this->get_settings_for_display(); |
| 1248 |
|
| 1249 |
$this->query_posts($settings['item_limit']['size']); |
| 1250 |
$wp_query = $this->get_query(); |
| 1251 |
|
| 1252 |
if (!$wp_query->found_posts) { |
| 1253 |
return; |
| 1254 |
} |
| 1255 |
|
| 1256 |
$this->render_header(); |
| 1257 |
|
| 1258 |
while ($wp_query->have_posts()) { |
| 1259 |
$wp_query->the_post(); |
| 1260 |
$thumbnail_size = $settings['primary_thumbnail_size']; |
| 1261 |
|
| 1262 |
$this->render_post_grid_item(get_the_ID(), $thumbnail_size, $settings['excerpt_length']); |
| 1263 |
} |
| 1264 |
|
| 1265 |
$this->render_footer(); |
| 1266 |
|
| 1267 |
wp_reset_postdata(); |
| 1268 |
} |
| 1269 |
} |
| 1270 |
|