| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimatePostKit\Modules\Author\Widgets; |
| 4 |
|
| 5 |
use UltimatePostKit\Base\Module_Base; |
| 6 |
use Elementor\Controls_Manager; |
| 7 |
use Elementor\Group_Control_Border; |
| 8 |
use Elementor\Group_Control_Box_Shadow; |
| 9 |
use Elementor\Group_Control_Typography; |
| 10 |
use Elementor\Group_Control_Text_Shadow; |
| 11 |
use Elementor\Group_Control_Background; |
| 12 |
use Elementor\Group_Control_Css_Filter; |
| 13 |
|
| 14 |
use UltimatePostKit\Traits\Global_Widget_Controls; |
| 15 |
|
| 16 |
if (!defined('ABSPATH')) { |
| 17 |
exit; |
| 18 |
} // Exit if accessed directly |
| 19 |
|
| 20 |
class Author extends Module_Base { |
| 21 |
private $_query = null; |
| 22 |
|
| 23 |
use Global_Widget_Controls; |
| 24 |
|
| 25 |
public function get_name() { |
| 26 |
return 'upk-author'; |
| 27 |
} |
| 28 |
|
| 29 |
public function get_title() { |
| 30 |
return BDTUPK . esc_html__('Author', 'ultimate-post-kit'); |
| 31 |
} |
| 32 |
|
| 33 |
public function get_icon() { |
| 34 |
return 'upk-widget-icon upk-icon-author'; |
| 35 |
} |
| 36 |
|
| 37 |
public function get_categories() { |
| 38 |
return ['ultimate-post-kit']; |
| 39 |
} |
| 40 |
|
| 41 |
public function get_keywords() { |
| 42 |
return ['post', 'grid', 'blog', 'recent', 'news', 'author', 'list']; |
| 43 |
} |
| 44 |
|
| 45 |
public function get_style_depends() { |
| 46 |
if ($this->upk_is_edit_mode()) { |
| 47 |
return ['upk-all-styles']; |
| 48 |
} else { |
| 49 |
return ['upk-font', 'upk-author']; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
public function get_custom_help_url() { |
| 54 |
return 'https://youtu.be/rW8rTtw62ko'; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
public function get_query() { |
| 59 |
return $this->_query; |
| 60 |
} |
| 61 |
|
| 62 |
public function has_widget_inner_wrapper(): bool { |
| 63 |
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
protected function register_controls() { |
| 68 |
$this->start_controls_section( |
| 69 |
'section_content_layout', |
| 70 |
[ |
| 71 |
'label' => esc_html__('Layout', 'ultimate-post-kit'), |
| 72 |
] |
| 73 |
); |
| 74 |
|
| 75 |
$this->add_control( |
| 76 |
'layout_style', |
| 77 |
[ |
| 78 |
'label' => esc_html__('Style', 'ultimate-post-kit'), |
| 79 |
'type' => Controls_Manager::SELECT, |
| 80 |
'default' => 'grid_1', |
| 81 |
'options' => [ |
| 82 |
'grid_1' => esc_html__('Grid', 'ultimate-post-kit'), |
| 83 |
'list' => esc_html__('List', 'ultimate-post-kit'), |
| 84 |
], |
| 85 |
] |
| 86 |
); |
| 87 |
|
| 88 |
$this->add_responsive_control( |
| 89 |
'grid_columns', |
| 90 |
[ |
| 91 |
'label' => __('Columns', 'ultimate-post-kit'), |
| 92 |
'type' => Controls_Manager::SELECT, |
| 93 |
'default' => '4', |
| 94 |
'tablet_default' => '2', |
| 95 |
'mobile_default' => '1', |
| 96 |
'options' => [ |
| 97 |
'1' => '1', |
| 98 |
'2' => '2', |
| 99 |
'3' => '3', |
| 100 |
'4' => '4', |
| 101 |
'5' => '5', |
| 102 |
'6' => '6', |
| 103 |
], |
| 104 |
'selectors' => [ |
| 105 |
'{{WRAPPER}} .upk-author-wrapper.upk-grid_1' => 'grid-template-columns: repeat({{SIZE}}, 1fr);', |
| 106 |
], |
| 107 |
'condition' => [ |
| 108 |
'layout_style' => ['grid_1'] |
| 109 |
] |
| 110 |
] |
| 111 |
); |
| 112 |
|
| 113 |
$this->add_responsive_control( |
| 114 |
'list_columns', |
| 115 |
[ |
| 116 |
'label' => __('Columns', 'ultimate-post-kit'), |
| 117 |
'type' => Controls_Manager::SELECT, |
| 118 |
'default' => '2', |
| 119 |
'tablet_default' => '2', |
| 120 |
'mobile_default' => '1', |
| 121 |
'options' => [ |
| 122 |
'1' => '1', |
| 123 |
'2' => '2', |
| 124 |
'3' => '3', |
| 125 |
], |
| 126 |
'selectors' => [ |
| 127 |
'{{WRAPPER}} .upk-author-wrapper.upk-list' => 'grid-template-columns: repeat({{SIZE}}, 1fr);', |
| 128 |
], |
| 129 |
'condition' => [ |
| 130 |
'layout_style' => 'list' |
| 131 |
] |
| 132 |
] |
| 133 |
); |
| 134 |
|
| 135 |
$this->add_responsive_control( |
| 136 |
'column_gap', |
| 137 |
[ |
| 138 |
'label' => esc_html__('Column Gap', 'ultimate-post-kit'), |
| 139 |
'type' => Controls_Manager::SLIDER, |
| 140 |
'default' => [ |
| 141 |
'size' => 20, |
| 142 |
], |
| 143 |
'selectors' => [ |
| 144 |
'{{WRAPPER}} .upk-author-wrapper' => 'grid-gap: {{SIZE}}{{UNIT}};', |
| 145 |
], |
| 146 |
] |
| 147 |
); |
| 148 |
|
| 149 |
$this->add_responsive_control( |
| 150 |
'alignment', |
| 151 |
[ |
| 152 |
'label' => __('Alignment', 'ultimate-post-kit'), |
| 153 |
'type' => Controls_Manager::CHOOSE, |
| 154 |
'options' => [ |
| 155 |
'left' => [ |
| 156 |
'title' => __('Left', 'ultimate-post-kit'), |
| 157 |
'icon' => 'eicon-text-align-left', |
| 158 |
], |
| 159 |
'center' => [ |
| 160 |
'title' => __('Center', 'ultimate-post-kit'), |
| 161 |
'icon' => 'eicon-text-align-center', |
| 162 |
], |
| 163 |
'right' => [ |
| 164 |
'title' => __('Right', 'ultimate-post-kit'), |
| 165 |
'icon' => 'eicon-text-align-right', |
| 166 |
] |
| 167 |
], |
| 168 |
'selectors' => [ |
| 169 |
'{{WRAPPER}} .upk-author-wrapper .upk-content' => 'text-align: {{VALUE}};', |
| 170 |
], |
| 171 |
] |
| 172 |
); |
| 173 |
|
| 174 |
$this->add_responsive_control( |
| 175 |
'meta_alignment', |
| 176 |
[ |
| 177 |
'label' => __('Meta Alignment', 'ultimate-post-kit'), |
| 178 |
'type' => Controls_Manager::CHOOSE, |
| 179 |
'options' => [ |
| 180 |
'left' => [ |
| 181 |
'title' => __('Left', 'ultimate-post-kit'), |
| 182 |
'icon' => 'eicon-text-align-left', |
| 183 |
], |
| 184 |
'center' => [ |
| 185 |
'title' => __('Center', 'ultimate-post-kit'), |
| 186 |
'icon' => 'eicon-text-align-center', |
| 187 |
], |
| 188 |
'flex-end' => [ |
| 189 |
'title' => __('Right', 'ultimate-post-kit'), |
| 190 |
'icon' => 'eicon-text-align-right', |
| 191 |
] |
| 192 |
], |
| 193 |
'selectors' => [ |
| 194 |
'{{WRAPPER}} .upk-author-wrapper .upk-link' => 'justify-content: {{VALUE}};', |
| 195 |
], |
| 196 |
] |
| 197 |
); |
| 198 |
|
| 199 |
$this->add_control( |
| 200 |
'hr', |
| 201 |
[ |
| 202 |
'type' => Controls_Manager::DIVIDER, |
| 203 |
] |
| 204 |
); |
| 205 |
|
| 206 |
$this->add_control( |
| 207 |
'show_author_avatar', |
| 208 |
[ |
| 209 |
'label' => esc_html__('Show Avatar', 'ultimate-post-kit'), |
| 210 |
'type' => Controls_Manager::SWITCHER, |
| 211 |
'default' => 'yes', |
| 212 |
] |
| 213 |
); |
| 214 |
|
| 215 |
$this->add_control( |
| 216 |
'author_avatar_size', |
| 217 |
[ |
| 218 |
'label' => __('Avatar Size', 'ultimate-post-kit'), |
| 219 |
'type' => Controls_Manager::SELECT, |
| 220 |
'condition' => [ |
| 221 |
'show_author_avatar' => 'yes' |
| 222 |
], |
| 223 |
'options' => [ |
| 224 |
'25' => '25 x 25', |
| 225 |
'35' => '35 x 35', |
| 226 |
'45' => '45 x 45', |
| 227 |
'60' => '60 x 60', |
| 228 |
'80' => '80 x 80', |
| 229 |
'100' => '100 x 100', |
| 230 |
'150' => '150 x 150', |
| 231 |
'200' => '200 x 200', |
| 232 |
'250' => '250 x 250', |
| 233 |
], |
| 234 |
'default' => '250', |
| 235 |
] |
| 236 |
); |
| 237 |
|
| 238 |
$this->add_control( |
| 239 |
'show_author_name', |
| 240 |
[ |
| 241 |
'label' => esc_html__('Show Name', 'ultimate-post-kit'), |
| 242 |
'type' => Controls_Manager::SWITCHER, |
| 243 |
'default' => 'yes', |
| 244 |
] |
| 245 |
); |
| 246 |
|
| 247 |
$this->add_control( |
| 248 |
'show_author_role', |
| 249 |
[ |
| 250 |
'label' => esc_html__('Show Role', 'ultimate-post-kit'), |
| 251 |
'type' => Controls_Manager::SWITCHER, |
| 252 |
'default' => 'yes', |
| 253 |
] |
| 254 |
); |
| 255 |
|
| 256 |
$this->add_control( |
| 257 |
'show_author_description', |
| 258 |
[ |
| 259 |
'label' => esc_html__('Show Description', 'ultimate-post-kit'), |
| 260 |
'type' => Controls_Manager::SWITCHER, |
| 261 |
'default' => 'yes', |
| 262 |
] |
| 263 |
); |
| 264 |
|
| 265 |
$this->add_control( |
| 266 |
'show_post_count', |
| 267 |
[ |
| 268 |
'label' => esc_html__('Show Post Count', 'ultimate-post-kit'), |
| 269 |
'type' => Controls_Manager::SWITCHER, |
| 270 |
'default' => 'yes', |
| 271 |
] |
| 272 |
); |
| 273 |
|
| 274 |
$this->add_control( |
| 275 |
'show_author_link', |
| 276 |
[ |
| 277 |
'label' => esc_html__('Show Social Link', 'ultimate-post-kit'), |
| 278 |
'type' => Controls_Manager::SWITCHER, |
| 279 |
'default' => 'yes', |
| 280 |
] |
| 281 |
); |
| 282 |
|
| 283 |
$this->add_control( |
| 284 |
'social_links', |
| 285 |
[ |
| 286 |
'label' => __('Social Links', 'ultimate-post-kit'), |
| 287 |
'type' => Controls_Manager::SELECT2, |
| 288 |
'multiple' => true, |
| 289 |
'label_block' => false, |
| 290 |
'default' => ['email', 'url'], |
| 291 |
'options' => ultimate_post_kit_user_contact_methods([], true), |
| 292 |
'condition' => [ |
| 293 |
'show_author_link' => 'yes' |
| 294 |
] |
| 295 |
] |
| 296 |
); |
| 297 |
|
| 298 |
$this->add_control( |
| 299 |
'show_pagination', |
| 300 |
[ |
| 301 |
'label' => esc_html__('Show Pagination', 'ultimate-post-kit') . BDTUPK_NC, |
| 302 |
'type' => Controls_Manager::SWITCHER, |
| 303 |
'separator' => 'before', |
| 304 |
] |
| 305 |
); |
| 306 |
|
| 307 |
$this->end_controls_section(); |
| 308 |
|
| 309 |
$this->start_controls_section( |
| 310 |
'section_post_grid_query', |
| 311 |
[ |
| 312 |
'label' => esc_html__('Query', 'ultimate-post-kit'), |
| 313 |
] |
| 314 |
); |
| 315 |
|
| 316 |
$this->add_control( |
| 317 |
'item_limit', |
| 318 |
[ |
| 319 |
'label' => esc_html__('Item Limit', 'ultimate-post-kit'), |
| 320 |
'type' => Controls_Manager::SLIDER, |
| 321 |
'range' => [ |
| 322 |
'px' => [ |
| 323 |
'min' => 1, |
| 324 |
'max' => 20, |
| 325 |
], |
| 326 |
], |
| 327 |
'default' => [ |
| 328 |
'size' => 8, |
| 329 |
], |
| 330 |
] |
| 331 |
); |
| 332 |
|
| 333 |
$this->add_control( |
| 334 |
'role', |
| 335 |
[ |
| 336 |
'label' => esc_html__('Role', 'ultimate-post-kit'), |
| 337 |
'type' => Controls_Manager::SELECT2, |
| 338 |
'multiple' => true, |
| 339 |
'label_block' => false, |
| 340 |
'options' => [ |
| 341 |
'subscriber' => esc_html__('Subscriber', 'ultimate-post-kit'), |
| 342 |
'contributor' => esc_html__('Contributor', 'ultimate-post-kit'), |
| 343 |
'author' => esc_html__('Author', 'ultimate-post-kit'), |
| 344 |
'editor' => esc_html__('Editor', 'ultimate-post-kit'), |
| 345 |
'administrator' => esc_html__('Administrator', 'ultimate-post-kit'), |
| 346 |
], |
| 347 |
] |
| 348 |
); |
| 349 |
|
| 350 |
$this->add_control( |
| 351 |
'exclude', |
| 352 |
[ |
| 353 |
'label' => esc_html__('Exclude User by ID', 'ultimate-post-kit'), |
| 354 |
'type' => Controls_Manager::TEXT, |
| 355 |
'placeholder' => __('1,2', 'ultimate-post-kit'), |
| 356 |
] |
| 357 |
); |
| 358 |
|
| 359 |
$this->add_control( |
| 360 |
'min_published_posts', |
| 361 |
[ |
| 362 |
'label' => esc_html__( 'Minimum Author Posts', 'ultimate-post-kit' ) . BDTUPK_NC, |
| 363 |
'type' => Controls_Manager::SLIDER, |
| 364 |
'range' => [ |
| 365 |
'px' => [ |
| 366 |
'min' => 0, |
| 367 |
'max' => 100, |
| 368 |
'step' => 1, |
| 369 |
], |
| 370 |
], |
| 371 |
'default' => [ |
| 372 |
'size' => 0, |
| 373 |
], |
| 374 |
'description' => esc_html__( |
| 375 |
'Only show authors who have at least this number of published posts. Set 0 to show all.', |
| 376 |
'ultimate-post-kit' |
| 377 |
), |
| 378 |
] |
| 379 |
); |
| 380 |
|
| 381 |
$this->add_control( |
| 382 |
'orderby', |
| 383 |
[ |
| 384 |
'label' => esc_html__('Order By', 'ultimate-post-kit'), |
| 385 |
'type' => Controls_Manager::SELECT, |
| 386 |
'default' => 'display_name', |
| 387 |
'options' => [ |
| 388 |
'display_name' => esc_html__('Nicename', 'ultimate-post-kit'), |
| 389 |
'post_count' => esc_html__('Post Count', 'ultimate-post-kit'), |
| 390 |
'registered' => esc_html__('Registered', 'ultimate-post-kit'), |
| 391 |
'rand' => esc_html__('Random', 'ultimate-post-kit'), |
| 392 |
], |
| 393 |
] |
| 394 |
); |
| 395 |
|
| 396 |
$this->add_control( |
| 397 |
'order', |
| 398 |
[ |
| 399 |
'label' => esc_html__('Order', 'ultimate-post-kit'), |
| 400 |
'type' => Controls_Manager::SELECT, |
| 401 |
'default' => 'desc', |
| 402 |
'options' => [ |
| 403 |
'asc' => esc_html__('ASC', 'ultimate-post-kit'), |
| 404 |
'desc' => esc_html__('DESC', 'ultimate-post-kit'), |
| 405 |
], |
| 406 |
] |
| 407 |
); |
| 408 |
|
| 409 |
$this->end_controls_section(); |
| 410 |
|
| 411 |
//Style |
| 412 |
$this->start_controls_section( |
| 413 |
'upk_section_style', |
| 414 |
[ |
| 415 |
'label' => esc_html__('Item', 'ultimate-post-kit'), |
| 416 |
'tab' => Controls_Manager::TAB_STYLE, |
| 417 |
] |
| 418 |
); |
| 419 |
|
| 420 |
$this->add_responsive_control( |
| 421 |
'content_padding', |
| 422 |
[ |
| 423 |
'label' => __('Content Padding', 'ultimate-post-kit'), |
| 424 |
'type' => Controls_Manager::DIMENSIONS, |
| 425 |
'size_units' => ['px', 'em', '%'], |
| 426 |
'selectors' => [ |
| 427 |
'{{WRAPPER}} .upk-author-wrapper .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 428 |
], |
| 429 |
] |
| 430 |
); |
| 431 |
|
| 432 |
$this->start_controls_tabs('tabs_item_style'); |
| 433 |
|
| 434 |
$this->start_controls_tab( |
| 435 |
'tab_item_normal', |
| 436 |
[ |
| 437 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 438 |
] |
| 439 |
); |
| 440 |
|
| 441 |
$this->add_control( |
| 442 |
'glassmorphism_effect', |
| 443 |
[ |
| 444 |
'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'), |
| 445 |
'type' => Controls_Manager::SWITCHER, |
| 446 |
// translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag |
| 447 |
'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), |
| 448 |
|
| 449 |
] |
| 450 |
); |
| 451 |
|
| 452 |
$this->add_control( |
| 453 |
'glassmorphism_blur_level', |
| 454 |
[ |
| 455 |
'label' => __('Blur Level', 'ultimate-post-kit'), |
| 456 |
'type' => Controls_Manager::SLIDER, |
| 457 |
'range' => [ |
| 458 |
'px' => [ |
| 459 |
'min' => 0, |
| 460 |
'step' => 1, |
| 461 |
'max' => 50, |
| 462 |
] |
| 463 |
], |
| 464 |
'default' => [ |
| 465 |
'size' => 5 |
| 466 |
], |
| 467 |
'selectors' => [ |
| 468 |
'{{WRAPPER}} .upk-author-wrapper .upk-item' => 'backdrop-filter: blur({{SIZE}}px); -webkit-backdrop-filter: blur({{SIZE}}px);' |
| 469 |
], |
| 470 |
'condition' => [ |
| 471 |
'glassmorphism_effect' => 'yes', |
| 472 |
] |
| 473 |
] |
| 474 |
); |
| 475 |
|
| 476 |
$this->add_group_control( |
| 477 |
Group_Control_Background::get_type(), |
| 478 |
[ |
| 479 |
'name' => 'item_background', |
| 480 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item', |
| 481 |
] |
| 482 |
); |
| 483 |
|
| 484 |
$this->add_group_control( |
| 485 |
Group_Control_Border::get_type(), |
| 486 |
[ |
| 487 |
'name' => 'item_border', |
| 488 |
'label' => __('Border', 'ultimate-post-kit'), |
| 489 |
'fields_options' => [ |
| 490 |
'border' => [ |
| 491 |
'default' => 'solid', |
| 492 |
], |
| 493 |
'width' => [ |
| 494 |
'default' => [ |
| 495 |
'top' => '1', |
| 496 |
'right' => '1', |
| 497 |
'bottom' => '1', |
| 498 |
'left' => '1', |
| 499 |
'isLinked' => false, |
| 500 |
], |
| 501 |
], |
| 502 |
'color' => [ |
| 503 |
'default' => '#e9edf4', |
| 504 |
], |
| 505 |
], |
| 506 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item', |
| 507 |
] |
| 508 |
); |
| 509 |
|
| 510 |
$this->add_responsive_control( |
| 511 |
'item_border_radius', |
| 512 |
[ |
| 513 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 514 |
'type' => Controls_Manager::DIMENSIONS, |
| 515 |
'size_units' => ['px', '%'], |
| 516 |
'selectors' => [ |
| 517 |
'{{WRAPPER}} .upk-author-wrapper .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 518 |
], |
| 519 |
] |
| 520 |
); |
| 521 |
|
| 522 |
$this->add_responsive_control( |
| 523 |
'item_padding', |
| 524 |
[ |
| 525 |
'label' => __('Padding', 'ultimate-post-kit'), |
| 526 |
'type' => Controls_Manager::DIMENSIONS, |
| 527 |
'size_units' => ['px', 'em', '%'], |
| 528 |
'selectors' => [ |
| 529 |
'{{WRAPPER}} .upk-author-wrapper .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 530 |
], |
| 531 |
] |
| 532 |
); |
| 533 |
|
| 534 |
$this->add_group_control( |
| 535 |
Group_Control_Box_Shadow::get_type(), |
| 536 |
[ |
| 537 |
'name' => 'item_box_shadow', |
| 538 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item', |
| 539 |
] |
| 540 |
); |
| 541 |
|
| 542 |
$this->end_controls_tab(); |
| 543 |
|
| 544 |
$this->start_controls_tab( |
| 545 |
'tab_item_hover', |
| 546 |
[ |
| 547 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 548 |
] |
| 549 |
); |
| 550 |
|
| 551 |
$this->add_group_control( |
| 552 |
Group_Control_Background::get_type(), |
| 553 |
[ |
| 554 |
'name' => 'item_hover_background', |
| 555 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item:hover', |
| 556 |
] |
| 557 |
); |
| 558 |
|
| 559 |
$this->add_control( |
| 560 |
'item_border_hover_color', |
| 561 |
[ |
| 562 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 563 |
'type' => Controls_Manager::COLOR, |
| 564 |
'selectors' => [ |
| 565 |
'{{WRAPPER}} .upk-author-wrapper .upk-item:hover' => 'border-color: {{VALUE}};', |
| 566 |
], |
| 567 |
'condition' => [ |
| 568 |
'item_border_border!' => '', |
| 569 |
] |
| 570 |
] |
| 571 |
); |
| 572 |
|
| 573 |
$this->add_group_control( |
| 574 |
Group_Control_Box_Shadow::get_type(), |
| 575 |
[ |
| 576 |
'name' => 'item_box_shadow_hover', |
| 577 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item:hover', |
| 578 |
] |
| 579 |
); |
| 580 |
|
| 581 |
$this->end_controls_tab(); |
| 582 |
|
| 583 |
$this->end_controls_tabs(); |
| 584 |
|
| 585 |
$this->end_controls_section(); |
| 586 |
|
| 587 |
$this->start_controls_section( |
| 588 |
'section_style_image', |
| 589 |
[ |
| 590 |
'label' => esc_html__('Avatar', 'ultimate-post-kit'), |
| 591 |
'tab' => Controls_Manager::TAB_STYLE, |
| 592 |
'condition' => [ |
| 593 |
'show_author_avatar' => 'yes', |
| 594 |
], |
| 595 |
] |
| 596 |
); |
| 597 |
|
| 598 |
$this->add_control( |
| 599 |
'image_mask_popover', |
| 600 |
[ |
| 601 |
'label' => esc_html__('Image Mask', 'ultimate-post-kit'), |
| 602 |
'type' => Controls_Manager::POPOVER_TOGGLE, |
| 603 |
'render_type' => 'ui', |
| 604 |
'return_value' => 'yes', |
| 605 |
] |
| 606 |
); |
| 607 |
|
| 608 |
$this->start_popover(); |
| 609 |
|
| 610 |
$this->add_control( |
| 611 |
'image_mask_shape', |
| 612 |
[ |
| 613 |
'label' => esc_html__('Masking Shape', 'ultimate-post-kit'), |
| 614 |
'title' => esc_html__('Masking Shape', 'ultimate-post-kit'), |
| 615 |
'type' => Controls_Manager::CHOOSE, |
| 616 |
'default' => 'default', |
| 617 |
'options' => [ |
| 618 |
'default' => [ |
| 619 |
'title' => esc_html__('Default Shapes', 'ultimate-post-kit'), |
| 620 |
'icon' => 'eicon-star', |
| 621 |
], |
| 622 |
'custom' => [ |
| 623 |
'title' => esc_html__('Custom Shape', 'ultimate-post-kit'), |
| 624 |
'icon' => 'eicon-image-bold', |
| 625 |
], |
| 626 |
], |
| 627 |
'toggle' => false, |
| 628 |
'condition' => [ |
| 629 |
'image_mask_popover' => 'yes', |
| 630 |
], |
| 631 |
] |
| 632 |
); |
| 633 |
|
| 634 |
$this->add_control( |
| 635 |
'image_mask_shape_default', |
| 636 |
[ |
| 637 |
'label' => _x('Default', 'Mask Image', 'ultimate-post-kit'), |
| 638 |
'label_block' => true, |
| 639 |
'show_label' => false, |
| 640 |
'type' => Controls_Manager::SELECT, |
| 641 |
'default' => 0, |
| 642 |
'options' => ultimate_post_kit_mask_shapes(), |
| 643 |
'selectors' => [ |
| 644 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-image: url({{VALUE}}); mask-image: url({{VALUE}});', |
| 645 |
], |
| 646 |
'condition' => [ |
| 647 |
'image_mask_popover' => 'yes', |
| 648 |
'image_mask_shape' => 'default', |
| 649 |
], |
| 650 |
'style_transfer' => true, |
| 651 |
] |
| 652 |
); |
| 653 |
|
| 654 |
$this->add_control( |
| 655 |
'image_mask_shape_custom', |
| 656 |
[ |
| 657 |
'label' => _x('Custom Shape', 'Mask Image', 'ultimate-post-kit'), |
| 658 |
'type' => Controls_Manager::MEDIA, |
| 659 |
'dynamic' => ['active' => true], |
| 660 |
'show_label' => false, |
| 661 |
'selectors' => [ |
| 662 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-image: url({{URL}}); mask-image: url({{URL}});', |
| 663 |
], |
| 664 |
'condition' => [ |
| 665 |
'image_mask_popover' => 'yes', |
| 666 |
'image_mask_shape' => 'custom', |
| 667 |
], |
| 668 |
] |
| 669 |
); |
| 670 |
|
| 671 |
$this->add_control( |
| 672 |
'image_mask_shape_position', |
| 673 |
[ |
| 674 |
'label' => esc_html__('Position', 'ultimate-post-kit'), |
| 675 |
'type' => Controls_Manager::SELECT, |
| 676 |
'default' => 'center-center', |
| 677 |
'options' => [ |
| 678 |
'center-center' => esc_html__('Center Center', 'ultimate-post-kit'), |
| 679 |
'center-left' => esc_html__('Center Left', 'ultimate-post-kit'), |
| 680 |
'center-right' => esc_html__('Center Right', 'ultimate-post-kit'), |
| 681 |
'top-center' => esc_html__('Top Center', 'ultimate-post-kit'), |
| 682 |
'top-left' => esc_html__('Top Left', 'ultimate-post-kit'), |
| 683 |
'top-right' => esc_html__('Top Right', 'ultimate-post-kit'), |
| 684 |
'bottom-center' => esc_html__('Bottom Center', 'ultimate-post-kit'), |
| 685 |
'bottom-left' => esc_html__('Bottom Left', 'ultimate-post-kit'), |
| 686 |
'bottom-right' => esc_html__('Bottom Right', 'ultimate-post-kit'), |
| 687 |
], |
| 688 |
'selectors_dictionary' => [ |
| 689 |
'center-center' => 'center center', |
| 690 |
'center-left' => 'center left', |
| 691 |
'center-right' => 'center right', |
| 692 |
'top-center' => 'top center', |
| 693 |
'top-left' => 'top left', |
| 694 |
'top-right' => 'top right', |
| 695 |
'bottom-center' => 'bottom center', |
| 696 |
'bottom-left' => 'bottom left', |
| 697 |
'bottom-right' => 'bottom right', |
| 698 |
], |
| 699 |
'selectors' => [ |
| 700 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-position: {{VALUE}}; mask-position: {{VALUE}};', |
| 701 |
], |
| 702 |
'condition' => [ |
| 703 |
'image_mask_popover' => 'yes', |
| 704 |
], |
| 705 |
] |
| 706 |
); |
| 707 |
|
| 708 |
$this->add_control( |
| 709 |
'image_mask_shape_size', |
| 710 |
[ |
| 711 |
'label' => esc_html__('Size', 'ultimate-post-kit'), |
| 712 |
'type' => Controls_Manager::SELECT, |
| 713 |
'default' => 'contain', |
| 714 |
'options' => [ |
| 715 |
'auto' => esc_html__('Auto', 'ultimate-post-kit'), |
| 716 |
'cover' => esc_html__('Cover', 'ultimate-post-kit'), |
| 717 |
'contain' => esc_html__('Contain', 'ultimate-post-kit'), |
| 718 |
'initial' => esc_html__('Custom', 'ultimate-post-kit'), |
| 719 |
], |
| 720 |
'selectors' => [ |
| 721 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-size: {{VALUE}}; mask-size: {{VALUE}};', |
| 722 |
], |
| 723 |
'condition' => [ |
| 724 |
'image_mask_popover' => 'yes', |
| 725 |
], |
| 726 |
] |
| 727 |
); |
| 728 |
|
| 729 |
$this->add_control( |
| 730 |
'image_mask_shape_custom_size', |
| 731 |
[ |
| 732 |
'label' => _x('Custom Size', 'Mask Image', 'ultimate-post-kit'), |
| 733 |
'type' => Controls_Manager::SLIDER, |
| 734 |
'responsive' => true, |
| 735 |
'size_units' => ['px', 'em', '%', 'vw'], |
| 736 |
'range' => [ |
| 737 |
'px' => [ |
| 738 |
'min' => 0, |
| 739 |
'max' => 1000, |
| 740 |
], |
| 741 |
'em' => [ |
| 742 |
'min' => 0, |
| 743 |
'max' => 100, |
| 744 |
], |
| 745 |
'%' => [ |
| 746 |
'min' => 0, |
| 747 |
'max' => 100, |
| 748 |
], |
| 749 |
'vw' => [ |
| 750 |
'min' => 0, |
| 751 |
'max' => 100, |
| 752 |
], |
| 753 |
], |
| 754 |
'default' => [ |
| 755 |
'size' => 100, |
| 756 |
'unit' => '%', |
| 757 |
], |
| 758 |
'required' => true, |
| 759 |
'selectors' => [ |
| 760 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-size: {{SIZE}}{{UNIT}}; mask-size: {{SIZE}}{{UNIT}};', |
| 761 |
], |
| 762 |
'condition' => [ |
| 763 |
'image_mask_popover' => 'yes', |
| 764 |
'image_mask_shape_size' => 'initial', |
| 765 |
], |
| 766 |
] |
| 767 |
); |
| 768 |
|
| 769 |
$this->add_control( |
| 770 |
'image_mask_shape_repeat', |
| 771 |
[ |
| 772 |
'label' => esc_html__('Repeat', 'ultimate-post-kit'), |
| 773 |
'type' => Controls_Manager::SELECT, |
| 774 |
'default' => 'no-repeat', |
| 775 |
'options' => [ |
| 776 |
'repeat' => esc_html__('Repeat', 'ultimate-post-kit'), |
| 777 |
'repeat-x' => esc_html__('Repeat-x', 'ultimate-post-kit'), |
| 778 |
'repeat-y' => esc_html__('Repeat-y', 'ultimate-post-kit'), |
| 779 |
'space' => esc_html__('Space', 'ultimate-post-kit'), |
| 780 |
'round' => esc_html__('Round', 'ultimate-post-kit'), |
| 781 |
'no-repeat' => esc_html__('No-repeat', 'ultimate-post-kit'), |
| 782 |
'repeat-space' => esc_html__('Repeat Space', 'ultimate-post-kit'), |
| 783 |
'round-space' => esc_html__('Round Space', 'ultimate-post-kit'), |
| 784 |
'no-repeat-round' => esc_html__('No-repeat Round', 'ultimate-post-kit'), |
| 785 |
], |
| 786 |
'selectors_dictionary' => [ |
| 787 |
'repeat' => 'repeat', |
| 788 |
'repeat-x' => 'repeat-x', |
| 789 |
'repeat-y' => 'repeat-y', |
| 790 |
'space' => 'space', |
| 791 |
'round' => 'round', |
| 792 |
'no-repeat' => 'no-repeat', |
| 793 |
'repeat-space' => 'repeat space', |
| 794 |
'round-space' => 'round space', |
| 795 |
'no-repeat-round' => 'no-repeat round', |
| 796 |
], |
| 797 |
'selectors' => [ |
| 798 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => '-webkit-mask-repeat: {{VALUE}}; mask-repeat: {{VALUE}};', |
| 799 |
], |
| 800 |
'condition' => [ |
| 801 |
'image_mask_popover' => 'yes', |
| 802 |
], |
| 803 |
] |
| 804 |
); |
| 805 |
|
| 806 |
$this->end_popover(); |
| 807 |
|
| 808 |
$this->add_group_control( |
| 809 |
Group_Control_Border::get_type(), |
| 810 |
[ |
| 811 |
'name' => 'avatar_border', |
| 812 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-image a img', |
| 813 |
'separator' => 'before' |
| 814 |
] |
| 815 |
); |
| 816 |
|
| 817 |
$this->add_responsive_control( |
| 818 |
'avatar_border_radius', |
| 819 |
[ |
| 820 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 821 |
'type' => Controls_Manager::DIMENSIONS, |
| 822 |
'size_units' => ['px', '%'], |
| 823 |
'selectors' => [ |
| 824 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 825 |
], |
| 826 |
] |
| 827 |
); |
| 828 |
|
| 829 |
$this->add_responsive_control( |
| 830 |
'avatar_padding', |
| 831 |
[ |
| 832 |
'label' => __('Padding', 'ultimate-post-kit'), |
| 833 |
'type' => Controls_Manager::DIMENSIONS, |
| 834 |
'size_units' => ['px', 'em', '%'], |
| 835 |
'selectors' => [ |
| 836 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 837 |
], |
| 838 |
] |
| 839 |
); |
| 840 |
|
| 841 |
$this->add_responsive_control( |
| 842 |
'avatar_margin', |
| 843 |
[ |
| 844 |
'label' => __('Margin', 'ultimate-post-kit'), |
| 845 |
'type' => Controls_Manager::DIMENSIONS, |
| 846 |
'size_units' => ['px', 'em', '%'], |
| 847 |
'selectors' => [ |
| 848 |
'{{WRAPPER}} .upk-author-wrapper .upk-image' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 849 |
], |
| 850 |
'condition' => [ |
| 851 |
'layout_style' => ['grid_1'] |
| 852 |
] |
| 853 |
] |
| 854 |
); |
| 855 |
|
| 856 |
$this->add_group_control( |
| 857 |
Group_Control_Box_Shadow::get_type(), |
| 858 |
[ |
| 859 |
'name' => 'avatar_box_shadow', |
| 860 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-image a img', |
| 861 |
] |
| 862 |
); |
| 863 |
|
| 864 |
$this->add_responsive_control( |
| 865 |
'avatar_size', |
| 866 |
[ |
| 867 |
'label' => esc_html__('Size(px)', 'ultimate-post-kit'), |
| 868 |
'type' => Controls_Manager::SLIDER, |
| 869 |
'range' => [ |
| 870 |
'px' => [ |
| 871 |
'min' => 50, |
| 872 |
'max' => 200, |
| 873 |
], |
| 874 |
], |
| 875 |
'selectors' => [ |
| 876 |
'{{WRAPPER}} .upk-author-wrapper .upk-image a img' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}}; min-width: {{SIZE}}{{UNIT}};', |
| 877 |
], |
| 878 |
'condition' => [ |
| 879 |
'layout_style' => ['list'] |
| 880 |
] |
| 881 |
] |
| 882 |
); |
| 883 |
|
| 884 |
$this->add_responsive_control( |
| 885 |
'avatar_spacing', |
| 886 |
[ |
| 887 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 888 |
'type' => Controls_Manager::SLIDER, |
| 889 |
'range' => [ |
| 890 |
'px' => [ |
| 891 |
'min' => 0, |
| 892 |
'max' => 50, |
| 893 |
], |
| 894 |
], |
| 895 |
'selectors' => [ |
| 896 |
'{{WRAPPER}} .upk-author-wrapper .upk-image' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 897 |
], |
| 898 |
'condition' => [ |
| 899 |
'layout_style' => 'list' |
| 900 |
] |
| 901 |
] |
| 902 |
); |
| 903 |
|
| 904 |
$this->start_controls_tabs('tabs_avatar_style'); |
| 905 |
|
| 906 |
$this->start_controls_tab( |
| 907 |
'tab_avatar_normal', |
| 908 |
[ |
| 909 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 910 |
] |
| 911 |
); |
| 912 |
|
| 913 |
$this->add_group_control( |
| 914 |
Group_Control_Css_Filter::get_type(), |
| 915 |
[ |
| 916 |
'name' => 'css_filters', |
| 917 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-image a img', |
| 918 |
] |
| 919 |
); |
| 920 |
|
| 921 |
$this->end_controls_tab(); |
| 922 |
|
| 923 |
$this->start_controls_tab( |
| 924 |
'tab_avatar_hover', |
| 925 |
[ |
| 926 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 927 |
] |
| 928 |
); |
| 929 |
|
| 930 |
$this->add_group_control( |
| 931 |
Group_Control_Css_Filter::get_type(), |
| 932 |
[ |
| 933 |
'name' => 'hover_css_filters', |
| 934 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-item:hover .upk-image a img', |
| 935 |
] |
| 936 |
); |
| 937 |
|
| 938 |
$this->end_controls_tab(); |
| 939 |
|
| 940 |
$this->end_controls_tabs(); |
| 941 |
|
| 942 |
$this->end_controls_section(); |
| 943 |
|
| 944 |
$this->start_controls_section( |
| 945 |
'section_style_title', |
| 946 |
[ |
| 947 |
'label' => esc_html__('Name', 'ultimate-post-kit'), |
| 948 |
'tab' => Controls_Manager::TAB_STYLE, |
| 949 |
'condition' => [ |
| 950 |
'show_author_name' => 'yes', |
| 951 |
], |
| 952 |
] |
| 953 |
); |
| 954 |
|
| 955 |
$this->add_control( |
| 956 |
'name_color', |
| 957 |
[ |
| 958 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 959 |
'type' => Controls_Manager::COLOR, |
| 960 |
'selectors' => [ |
| 961 |
'{{WRAPPER}} .upk-author-wrapper .upk-name a' => 'color: {{VALUE}};', |
| 962 |
], |
| 963 |
] |
| 964 |
); |
| 965 |
|
| 966 |
$this->add_control( |
| 967 |
'name_hover_color', |
| 968 |
[ |
| 969 |
'label' => esc_html__('Hover Color', 'ultimate-post-kit'), |
| 970 |
'type' => Controls_Manager::COLOR, |
| 971 |
'selectors' => [ |
| 972 |
'{{WRAPPER}} .upk-author-wrapper .upk-name a:hover' => 'color: {{VALUE}};', |
| 973 |
], |
| 974 |
] |
| 975 |
); |
| 976 |
|
| 977 |
$this->add_group_control( |
| 978 |
Group_Control_Typography::get_type(), |
| 979 |
[ |
| 980 |
'name' => 'name_typography', |
| 981 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 982 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-name a', |
| 983 |
] |
| 984 |
); |
| 985 |
|
| 986 |
$this->add_group_control( |
| 987 |
Group_Control_Text_Shadow::get_type(), |
| 988 |
[ |
| 989 |
'name' => 'name_text_shadow', |
| 990 |
'label' => __('Text Shadow', 'ultimate-post-kit'), |
| 991 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-name a', |
| 992 |
] |
| 993 |
); |
| 994 |
|
| 995 |
$this->end_controls_section(); |
| 996 |
|
| 997 |
$this->start_controls_section( |
| 998 |
'section_style_role', |
| 999 |
[ |
| 1000 |
'label' => esc_html__('Role', 'ultimate-post-kit'), |
| 1001 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1002 |
'condition' => [ |
| 1003 |
'show_author_role' => 'yes', |
| 1004 |
] |
| 1005 |
] |
| 1006 |
); |
| 1007 |
|
| 1008 |
$this->add_control( |
| 1009 |
'role_color', |
| 1010 |
[ |
| 1011 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1012 |
'type' => Controls_Manager::COLOR, |
| 1013 |
'selectors' => [ |
| 1014 |
'{{WRAPPER}} .upk-author-wrapper .upk-role' => 'color: {{VALUE}};', |
| 1015 |
], |
| 1016 |
] |
| 1017 |
); |
| 1018 |
|
| 1019 |
$this->add_group_control( |
| 1020 |
Group_Control_Typography::get_type(), |
| 1021 |
[ |
| 1022 |
'name' => 'role_typography', |
| 1023 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1024 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-role', |
| 1025 |
] |
| 1026 |
); |
| 1027 |
|
| 1028 |
$this->add_responsive_control( |
| 1029 |
'role_spacing', |
| 1030 |
[ |
| 1031 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 1032 |
'type' => Controls_Manager::SLIDER, |
| 1033 |
'range' => [ |
| 1034 |
'px' => [ |
| 1035 |
'min' => 0, |
| 1036 |
'max' => 50, |
| 1037 |
], |
| 1038 |
], |
| 1039 |
'selectors' => [ |
| 1040 |
'{{WRAPPER}} .upk-author-wrapper .upk-role' => 'padding-top: {{SIZE}}{{UNIT}};', |
| 1041 |
], |
| 1042 |
] |
| 1043 |
); |
| 1044 |
|
| 1045 |
$this->end_controls_section(); |
| 1046 |
|
| 1047 |
$this->start_controls_section( |
| 1048 |
'section_style_description', |
| 1049 |
[ |
| 1050 |
'label' => esc_html__('Description', 'ultimate-post-kit'), |
| 1051 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1052 |
'condition' => [ |
| 1053 |
'show_author_description' => 'yes', |
| 1054 |
] |
| 1055 |
] |
| 1056 |
); |
| 1057 |
|
| 1058 |
$this->add_control( |
| 1059 |
'description_color', |
| 1060 |
[ |
| 1061 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1062 |
'type' => Controls_Manager::COLOR, |
| 1063 |
'selectors' => [ |
| 1064 |
'{{WRAPPER}} .upk-author-wrapper .upk-description' => 'color: {{VALUE}};', |
| 1065 |
], |
| 1066 |
] |
| 1067 |
); |
| 1068 |
|
| 1069 |
$this->add_group_control( |
| 1070 |
Group_Control_Typography::get_type(), |
| 1071 |
[ |
| 1072 |
'name' => 'description_typography', |
| 1073 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1074 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-description', |
| 1075 |
] |
| 1076 |
); |
| 1077 |
|
| 1078 |
$this->add_responsive_control( |
| 1079 |
'description_spacing', |
| 1080 |
[ |
| 1081 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 1082 |
'type' => Controls_Manager::SLIDER, |
| 1083 |
'range' => [ |
| 1084 |
'px' => [ |
| 1085 |
'min' => 0, |
| 1086 |
'max' => 50, |
| 1087 |
], |
| 1088 |
], |
| 1089 |
'selectors' => [ |
| 1090 |
'{{WRAPPER}} .upk-author-wrapper .upk-description' => 'padding-top: {{SIZE}}{{UNIT}};', |
| 1091 |
], |
| 1092 |
] |
| 1093 |
); |
| 1094 |
|
| 1095 |
$this->end_controls_section(); |
| 1096 |
|
| 1097 |
$this->start_controls_section( |
| 1098 |
'section_style_post_count', |
| 1099 |
[ |
| 1100 |
'label' => esc_html__('Post Count', 'ultimate-post-kit'), |
| 1101 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1102 |
'condition' => [ |
| 1103 |
'show_post_count' => 'yes', |
| 1104 |
] |
| 1105 |
] |
| 1106 |
); |
| 1107 |
|
| 1108 |
$this->add_control( |
| 1109 |
'post_count_color', |
| 1110 |
[ |
| 1111 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1112 |
'type' => Controls_Manager::COLOR, |
| 1113 |
'selectors' => [ |
| 1114 |
'{{WRAPPER}} .upk-author-wrapper .upk-post-count' => 'color: {{VALUE}};', |
| 1115 |
], |
| 1116 |
] |
| 1117 |
); |
| 1118 |
|
| 1119 |
$this->add_group_control( |
| 1120 |
Group_Control_Background::get_type(), |
| 1121 |
[ |
| 1122 |
'name' => 'post_count_background', |
| 1123 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-post-count', |
| 1124 |
] |
| 1125 |
); |
| 1126 |
|
| 1127 |
$this->add_group_control( |
| 1128 |
Group_Control_Border::get_type(), |
| 1129 |
[ |
| 1130 |
'name' => 'post_count_border', |
| 1131 |
'label' => __('Border', 'ultimate-post-kit'), |
| 1132 |
'fields_options' => [ |
| 1133 |
'border' => [ |
| 1134 |
'default' => 'solid', |
| 1135 |
], |
| 1136 |
'width' => [ |
| 1137 |
'default' => [ |
| 1138 |
'top' => '1', |
| 1139 |
'right' => '1', |
| 1140 |
'bottom' => '1', |
| 1141 |
'left' => '1', |
| 1142 |
'isLinked' => false, |
| 1143 |
], |
| 1144 |
], |
| 1145 |
// 'color' => [ |
| 1146 |
// 'default' => '#8D99AE', |
| 1147 |
// ], |
| 1148 |
], |
| 1149 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-post-count', |
| 1150 |
] |
| 1151 |
); |
| 1152 |
|
| 1153 |
$this->add_responsive_control( |
| 1154 |
'post_count_border_radius', |
| 1155 |
[ |
| 1156 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 1157 |
'type' => Controls_Manager::DIMENSIONS, |
| 1158 |
'size_units' => ['px', '%'], |
| 1159 |
'selectors' => [ |
| 1160 |
'{{WRAPPER}} .upk-author-wrapper .upk-post-count' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1161 |
], |
| 1162 |
] |
| 1163 |
); |
| 1164 |
|
| 1165 |
$this->add_responsive_control( |
| 1166 |
'post_count_padding', |
| 1167 |
[ |
| 1168 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 1169 |
'type' => Controls_Manager::DIMENSIONS, |
| 1170 |
'size_units' => ['px', 'em', '%'], |
| 1171 |
'selectors' => [ |
| 1172 |
'{{WRAPPER}} .upk-author-wrapper .upk-post-count' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1173 |
], |
| 1174 |
] |
| 1175 |
); |
| 1176 |
|
| 1177 |
$this->add_group_control( |
| 1178 |
Group_Control_Box_Shadow::get_type(), |
| 1179 |
[ |
| 1180 |
'name' => 'post_count_shadow', |
| 1181 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-post-count', |
| 1182 |
] |
| 1183 |
); |
| 1184 |
|
| 1185 |
$this->add_group_control( |
| 1186 |
Group_Control_Typography::get_type(), |
| 1187 |
[ |
| 1188 |
'name' => 'post_count_typography', |
| 1189 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1190 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-post-count', |
| 1191 |
] |
| 1192 |
); |
| 1193 |
|
| 1194 |
$this->add_responsive_control( |
| 1195 |
'post_count_spacing', |
| 1196 |
[ |
| 1197 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 1198 |
'type' => Controls_Manager::SLIDER, |
| 1199 |
'range' => [ |
| 1200 |
'px' => [ |
| 1201 |
'min' => 0, |
| 1202 |
'max' => 50, |
| 1203 |
], |
| 1204 |
], |
| 1205 |
'selectors' => [ |
| 1206 |
'{{WRAPPER}} .upk-author-wrapper .upk-post-count' => 'top: {{SIZE}}{{UNIT}}; right: {{SIZE}}{{UNIT}};', |
| 1207 |
], |
| 1208 |
] |
| 1209 |
); |
| 1210 |
|
| 1211 |
$this->end_controls_section(); |
| 1212 |
|
| 1213 |
$this->start_controls_section( |
| 1214 |
'section_style_social_link', |
| 1215 |
[ |
| 1216 |
'label' => esc_html__('Social Link', 'ultimate-post-kit'), |
| 1217 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1218 |
'condition' => [ |
| 1219 |
'show_author_link' => 'yes', |
| 1220 |
], |
| 1221 |
] |
| 1222 |
); |
| 1223 |
|
| 1224 |
$this->add_responsive_control( |
| 1225 |
'social_link_bottom_spacing', |
| 1226 |
[ |
| 1227 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 1228 |
'type' => Controls_Manager::SLIDER, |
| 1229 |
'range' => [ |
| 1230 |
'px' => [ |
| 1231 |
'min' => 0, |
| 1232 |
'max' => 50, |
| 1233 |
], |
| 1234 |
], |
| 1235 |
'selectors' => [ |
| 1236 |
'{{WRAPPER}} .upk-author-wrapper .upk-link' => 'padding-top: {{SIZE}}{{UNIT}};', |
| 1237 |
], |
| 1238 |
] |
| 1239 |
); |
| 1240 |
|
| 1241 |
$this->start_controls_tabs('tabs_social_link_style'); |
| 1242 |
|
| 1243 |
$this->start_controls_tab( |
| 1244 |
'tab_social_link_normal', |
| 1245 |
[ |
| 1246 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 1247 |
] |
| 1248 |
); |
| 1249 |
|
| 1250 |
$this->add_control( |
| 1251 |
'social_link_color', |
| 1252 |
[ |
| 1253 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1254 |
'type' => Controls_Manager::COLOR, |
| 1255 |
'selectors' => [ |
| 1256 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a' => 'color: {{VALUE}};', |
| 1257 |
], |
| 1258 |
] |
| 1259 |
); |
| 1260 |
|
| 1261 |
$this->add_group_control( |
| 1262 |
Group_Control_Background::get_type(), |
| 1263 |
[ |
| 1264 |
'name' => 'social_link_background', |
| 1265 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-link a', |
| 1266 |
] |
| 1267 |
); |
| 1268 |
|
| 1269 |
$this->add_group_control( |
| 1270 |
Group_Control_Border::get_type(), |
| 1271 |
[ |
| 1272 |
'name' => 'social_link_border', |
| 1273 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-link a', |
| 1274 |
] |
| 1275 |
); |
| 1276 |
|
| 1277 |
$this->add_responsive_control( |
| 1278 |
'social_link_border_radius', |
| 1279 |
[ |
| 1280 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 1281 |
'type' => Controls_Manager::DIMENSIONS, |
| 1282 |
'size_units' => ['px', '%'], |
| 1283 |
'selectors' => [ |
| 1284 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1285 |
], |
| 1286 |
] |
| 1287 |
); |
| 1288 |
|
| 1289 |
$this->add_responsive_control( |
| 1290 |
'social_link_padding', |
| 1291 |
[ |
| 1292 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 1293 |
'type' => Controls_Manager::DIMENSIONS, |
| 1294 |
'size_units' => ['px', 'em', '%'], |
| 1295 |
'selectors' => [ |
| 1296 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1297 |
], |
| 1298 |
] |
| 1299 |
); |
| 1300 |
|
| 1301 |
$this->add_responsive_control( |
| 1302 |
'social_link_spacing', |
| 1303 |
[ |
| 1304 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 1305 |
'type' => Controls_Manager::SLIDER, |
| 1306 |
'range' => [ |
| 1307 |
'px' => [ |
| 1308 |
'min' => 0, |
| 1309 |
'max' => 50, |
| 1310 |
], |
| 1311 |
], |
| 1312 |
'selectors' => [ |
| 1313 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a+a' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 1314 |
], |
| 1315 |
] |
| 1316 |
); |
| 1317 |
|
| 1318 |
$this->add_group_control( |
| 1319 |
Group_Control_Box_Shadow::get_type(), |
| 1320 |
[ |
| 1321 |
'name' => 'social_link_shadow', |
| 1322 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-link a', |
| 1323 |
] |
| 1324 |
); |
| 1325 |
|
| 1326 |
$this->add_group_control( |
| 1327 |
Group_Control_Typography::get_type(), |
| 1328 |
[ |
| 1329 |
'name' => 'social_link_typography', |
| 1330 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1331 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-link a', |
| 1332 |
] |
| 1333 |
); |
| 1334 |
|
| 1335 |
$this->end_controls_tab(); |
| 1336 |
|
| 1337 |
$this->start_controls_tab( |
| 1338 |
'tab_social_link_hover', |
| 1339 |
[ |
| 1340 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 1341 |
] |
| 1342 |
); |
| 1343 |
|
| 1344 |
$this->add_control( |
| 1345 |
'social_link_hover_color', |
| 1346 |
[ |
| 1347 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1348 |
'type' => Controls_Manager::COLOR, |
| 1349 |
'selectors' => [ |
| 1350 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a:hover' => 'color: {{VALUE}};', |
| 1351 |
], |
| 1352 |
] |
| 1353 |
); |
| 1354 |
|
| 1355 |
$this->add_group_control( |
| 1356 |
Group_Control_Background::get_type(), |
| 1357 |
[ |
| 1358 |
'name' => 'social_link_hover_background', |
| 1359 |
'selector' => '{{WRAPPER}} .upk-author-wrapper .upk-link a:hover', |
| 1360 |
] |
| 1361 |
); |
| 1362 |
|
| 1363 |
$this->add_control( |
| 1364 |
'social_link_hover_border_color', |
| 1365 |
[ |
| 1366 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 1367 |
'type' => Controls_Manager::COLOR, |
| 1368 |
'condition' => [ |
| 1369 |
'social_link_border_border!' => '', |
| 1370 |
], |
| 1371 |
'selectors' => [ |
| 1372 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a:hover' => 'border-color: {{VALUE}};', |
| 1373 |
], |
| 1374 |
] |
| 1375 |
); |
| 1376 |
|
| 1377 |
$this->add_responsive_control( |
| 1378 |
'social_link_border_radius_hover', |
| 1379 |
[ |
| 1380 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 1381 |
'type' => Controls_Manager::DIMENSIONS, |
| 1382 |
'size_units' => ['px', '%'], |
| 1383 |
'selectors' => [ |
| 1384 |
'{{WRAPPER}} .upk-author-wrapper .upk-link a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1385 |
], |
| 1386 |
] |
| 1387 |
); |
| 1388 |
|
| 1389 |
$this->end_controls_tab(); |
| 1390 |
|
| 1391 |
$this->end_controls_tabs(); |
| 1392 |
|
| 1393 |
$this->end_controls_section(); |
| 1394 |
|
| 1395 |
//Global Pagination Style Controls |
| 1396 |
$this->register_pagination_controls(); |
| 1397 |
} |
| 1398 |
|
| 1399 |
public function render() { |
| 1400 |
$settings = $this->get_settings_for_display(); |
| 1401 |
|
| 1402 |
$min_published_posts = isset($settings['min_published_posts']['size']) ? absint($settings['min_published_posts']['size']) : 0; |
| 1403 |
$item_limit = (int) $settings['item_limit']['size']; |
| 1404 |
$show_pagination = !empty($settings['show_pagination']); |
| 1405 |
|
| 1406 |
$number = ($min_published_posts > 0 || $show_pagination) ? -1 : $item_limit; |
| 1407 |
|
| 1408 |
$users = get_users([ |
| 1409 |
'orderby' => $settings['orderby'], |
| 1410 |
'order' => $settings['order'], |
| 1411 |
'role__in' => (!empty($settings['role'])) ? $settings['role'] : null, |
| 1412 |
'number' => $number, |
| 1413 |
// phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. |
| 1414 |
'exclude' => array_filter(array_map('absint', explode(',', esc_attr($settings['exclude'])))), |
| 1415 |
]); |
| 1416 |
|
| 1417 |
if ($min_published_posts > 0) { |
| 1418 |
$users = array_filter($users, function ($user) use ($min_published_posts) { |
| 1419 |
return count_user_posts($user->ID) >= $min_published_posts; |
| 1420 |
}); |
| 1421 |
$users = array_values($users); |
| 1422 |
} |
| 1423 |
|
| 1424 |
$total_users = count($users); |
| 1425 |
$total_pages = $item_limit > 0 ? (int) ceil($total_users / $item_limit) : 1; |
| 1426 |
$paged = max(1, (int) get_query_var('paged'), (int) get_query_var('page')); |
| 1427 |
|
| 1428 |
if ($show_pagination) { |
| 1429 |
$offset = ($paged - 1) * $item_limit; |
| 1430 |
$users = array_slice($users, $offset, $item_limit); |
| 1431 |
} else { |
| 1432 |
$users = array_slice($users, 0, $item_limit); |
| 1433 |
} |
| 1434 |
|
| 1435 |
$social_links = $settings['social_links']; |
| 1436 |
|
| 1437 |
?> |
| 1438 |
<div class="upk-author"> |
| 1439 |
<div class="upk-author-wrapper upk-<?php echo esc_attr($settings['layout_style']) ?>"> |
| 1440 |
<?php |
| 1441 |
foreach ($users as $author) { |
| 1442 |
|
| 1443 |
?> |
| 1444 |
<div class="upk-item"> |
| 1445 |
<?php if ($settings['show_author_avatar']) : |
| 1446 |
$author_posts_url = get_author_posts_url($author->ID); |
| 1447 |
?> |
| 1448 |
<div class="upk-image"> |
| 1449 |
<a href="<?php echo esc_url($author_posts_url); ?>"> |
| 1450 |
<?php echo get_avatar($author->ID, $settings['author_avatar_size']); ?> |
| 1451 |
</a> |
| 1452 |
</div> |
| 1453 |
<?php endif; ?> |
| 1454 |
|
| 1455 |
<div class="upk-content"> |
| 1456 |
<?php if ($settings['show_author_name']) : ?> |
| 1457 |
<div class="upk-name"> |
| 1458 |
<a href="<?php echo esc_url(get_author_posts_url($author->ID)); ?>"> |
| 1459 |
<?php echo esc_html(get_the_author_meta('display_name', $author->ID)); ?> |
| 1460 |
</a> |
| 1461 |
</div> |
| 1462 |
<?php endif; ?> |
| 1463 |
|
| 1464 |
<?php if ($settings['show_author_role']) : ?> |
| 1465 |
<div class="upk-role"> |
| 1466 |
<?php echo esc_html( get_user_role( $author->ID ) ); ?> |
| 1467 |
</div> |
| 1468 |
<?php endif; ?> |
| 1469 |
|
| 1470 |
<?php if ($settings['show_author_description'] and get_the_author_meta('description', $author->ID)) : ?> |
| 1471 |
<div class="upk-description"> |
| 1472 |
<?php echo wp_kses_post(get_the_author_meta('description', $author->ID)); ?> |
| 1473 |
</div> |
| 1474 |
<?php endif; ?> |
| 1475 |
|
| 1476 |
<?php if ($settings['show_author_link'] and !empty($social_links)) : ?> |
| 1477 |
|
| 1478 |
<div class="upk-link"> |
| 1479 |
|
| 1480 |
|
| 1481 |
<?php foreach ($social_links as $link) : ?> |
| 1482 |
|
| 1483 |
<?php if (get_the_author_meta($link, $author->ID)) : ?> |
| 1484 |
<?php |
| 1485 |
|
| 1486 |
$final_url = get_the_author_meta($link, $author->ID); |
| 1487 |
$alt_title = esc_html__( 'Click here to go ', 'ultimate-post-kit' ) . ucwords( $link ); |
| 1488 |
|
| 1489 |
if ($link == 'email') { |
| 1490 |
$final_url = 'mailto:' . get_the_author_meta($link, $author->ID); |
| 1491 |
$alt_title = esc_html__( 'Click here to ', 'ultimate-post-kit' ) . ucwords( $link ); |
| 1492 |
} |
| 1493 |
|
| 1494 |
?> |
| 1495 |
|
| 1496 |
<a href="<?php echo esc_url($final_url); ?>" title="<?php echo esc_attr($alt_title); ?>"> |
| 1497 |
<i class="upk-icon-<?php echo esc_attr($link); ?>" aria-hidden="true"></i> |
| 1498 |
</a> |
| 1499 |
<?php endif; ?> |
| 1500 |
|
| 1501 |
<?php endforeach; ?> |
| 1502 |
|
| 1503 |
|
| 1504 |
</div> |
| 1505 |
<?php endif; ?> |
| 1506 |
|
| 1507 |
</div> |
| 1508 |
|
| 1509 |
<?php if ($settings['show_post_count']) : ?> |
| 1510 |
<div class="upk-post-count"> |
| 1511 |
<?php |
| 1512 |
|
| 1513 |
$count = count_user_posts($author->ID); |
| 1514 |
/* translators: %s: Number of posts. */ |
| 1515 |
$total_count = sprintf(_n('Post: %s', 'Posts: %s', $count, 'ultimate-post-kit'), $count); |
| 1516 |
|
| 1517 |
echo esc_attr($total_count); |
| 1518 |
|
| 1519 |
?> |
| 1520 |
|
| 1521 |
</div> |
| 1522 |
<?php endif; ?> |
| 1523 |
|
| 1524 |
</div> |
| 1525 |
<?php } ?> |
| 1526 |
</div> |
| 1527 |
</div> |
| 1528 |
|
| 1529 |
<?php if ($show_pagination && $total_pages > 1) : ?> |
| 1530 |
<div class="ep-pagination"> |
| 1531 |
<?php |
| 1532 |
$author_pagination_query = new \stdClass(); |
| 1533 |
$author_pagination_query->max_num_pages = $total_pages; |
| 1534 |
$author_pagination_query->query_vars = ['paged' => $paged, 'page' => $paged]; |
| 1535 |
ultimate_post_kit_post_pagination($author_pagination_query, $this->get_id()); |
| 1536 |
?> |
| 1537 |
</div> |
| 1538 |
<?php endif; ?> |
| 1539 |
<?php |
| 1540 |
} |
| 1541 |
} |
| 1542 |
|