| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimatePostKit\Modules\RambleGrid\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\Includes\Controls\GroupQuery\Group_Control_Query; |
| 17 |
use WP_Query; |
| 18 |
|
| 19 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 20 |
|
| 21 |
class Ramble_Grid extends Group_Control_Query { |
| 22 |
|
| 23 |
use Global_Widget_Controls; |
| 24 |
use Global_Widget_Functions; |
| 25 |
|
| 26 |
private $_query = null; |
| 27 |
|
| 28 |
public function get_name() { |
| 29 |
return 'upk-ramble-grid'; |
| 30 |
} |
| 31 |
|
| 32 |
public function get_title() { |
| 33 |
return BDTUPK . esc_html__('Ramble Grid', 'ultimate-post-kit'); |
| 34 |
} |
| 35 |
|
| 36 |
public function get_icon() { |
| 37 |
return 'upk-widget-icon upk-icon-ramble-grid'; |
| 38 |
} |
| 39 |
|
| 40 |
public function get_categories() { |
| 41 |
return ['ultimate-post-kit']; |
| 42 |
} |
| 43 |
|
| 44 |
public function get_keywords() { |
| 45 |
return ['post', 'grid', 'blog', 'recent', 'news', 'ramble']; |
| 46 |
} |
| 47 |
|
| 48 |
public function get_style_depends() { |
| 49 |
if ($this->upk_is_edit_mode()) { |
| 50 |
return ['upk-all-styles']; |
| 51 |
} else { |
| 52 |
return ['upk-font', 'upk-ramble-grid']; |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
public function get_script_depends() { |
| 57 |
if ($this->upk_is_edit_mode()) { |
| 58 |
return ['upk-all-scripts']; |
| 59 |
} else { |
| 60 |
return ['upk-ajax-loadmore']; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
public function get_custom_help_url() { |
| 65 |
return 'https://youtu.be/mKdxqk3M2qI'; |
| 66 |
} |
| 67 |
|
| 68 |
public function get_query() { |
| 69 |
return $this->_query; |
| 70 |
} |
| 71 |
|
| 72 |
public function has_widget_inner_wrapper(): bool { |
| 73 |
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
protected function register_controls() { |
| 78 |
$this->start_controls_section( |
| 79 |
'section_content_layout', |
| 80 |
[ |
| 81 |
'label' => esc_html__('Layout', 'ultimate-post-kit'), |
| 82 |
] |
| 83 |
); |
| 84 |
|
| 85 |
$this->add_responsive_control( |
| 86 |
'columns', |
| 87 |
[ |
| 88 |
'label' => __('Columns', 'ultimate-post-kit'), |
| 89 |
'type' => Controls_Manager::SELECT, |
| 90 |
'default' => '3', |
| 91 |
'tablet_default' => '2', |
| 92 |
'mobile_default' => '1', |
| 93 |
'options' => [ |
| 94 |
'1' => '1', |
| 95 |
'2' => '2', |
| 96 |
'3' => '3', |
| 97 |
'4' => '4', |
| 98 |
'5' => '5', |
| 99 |
'6' => '6', |
| 100 |
], |
| 101 |
'selectors' => [ |
| 102 |
'{{WRAPPER}} .upk-ramble-grid .upk-post-wrap' => 'grid-template-columns: repeat({{SIZE}}, 1fr);', |
| 103 |
], |
| 104 |
] |
| 105 |
); |
| 106 |
|
| 107 |
$this->add_responsive_control( |
| 108 |
'row_gap', |
| 109 |
[ |
| 110 |
'label' => esc_html__('Row Gap', 'ultimate-post-kit'), |
| 111 |
'type' => Controls_Manager::SLIDER, |
| 112 |
'default' => [ |
| 113 |
'size' => 20, |
| 114 |
], |
| 115 |
'selectors' => [ |
| 116 |
'{{WRAPPER}} .upk-ramble-grid .upk-post-wrap' => 'grid-row-gap: {{SIZE}}{{UNIT}};', |
| 117 |
], |
| 118 |
] |
| 119 |
); |
| 120 |
|
| 121 |
$this->add_responsive_control( |
| 122 |
'column_gap', |
| 123 |
[ |
| 124 |
'label' => esc_html__('Column Gap', 'ultimate-post-kit'), |
| 125 |
'type' => Controls_Manager::SLIDER, |
| 126 |
'default' => [ |
| 127 |
'size' => 20, |
| 128 |
], |
| 129 |
'selectors' => [ |
| 130 |
'{{WRAPPER}} .upk-ramble-grid .upk-post-wrap' => 'grid-column-gap: {{SIZE}}{{UNIT}};', |
| 131 |
], |
| 132 |
] |
| 133 |
); |
| 134 |
|
| 135 |
$this->add_responsive_control( |
| 136 |
'item_height', |
| 137 |
[ |
| 138 |
'label' => esc_html__('Item Height(px)', 'ultimate-post-kit'), |
| 139 |
'type' => Controls_Manager::SLIDER, |
| 140 |
'range' => [ |
| 141 |
'px' => [ |
| 142 |
'min' => 200, |
| 143 |
'max' => 600, |
| 144 |
], |
| 145 |
], |
| 146 |
'selectors' => [ |
| 147 |
'{{WRAPPER}} .upk-ramble-grid .upk-item' => 'height: {{SIZE}}{{UNIT}};', |
| 148 |
], |
| 149 |
] |
| 150 |
); |
| 151 |
|
| 152 |
$this->add_group_control( |
| 153 |
Group_Control_Image_Size::get_type(), |
| 154 |
[ |
| 155 |
'name' => 'primary_thumbnail', |
| 156 |
'exclude' => ['custom'], |
| 157 |
'default' => 'medium', |
| 158 |
] |
| 159 |
); |
| 160 |
|
| 161 |
$this->end_controls_section(); |
| 162 |
|
| 163 |
// Query Settings |
| 164 |
$this->start_controls_section( |
| 165 |
'section_post_query_builder', |
| 166 |
[ |
| 167 |
'label' => __('Query', 'ultimate-post-kit'), |
| 168 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 169 |
] |
| 170 |
); |
| 171 |
|
| 172 |
$this->add_control( |
| 173 |
'item_limit', |
| 174 |
[ |
| 175 |
'label' => esc_html__('Item Limit', 'ultimate-post-kit'), |
| 176 |
'type' => Controls_Manager::SLIDER, |
| 177 |
'range' => [ |
| 178 |
'px' => [ |
| 179 |
'min' => 1, |
| 180 |
'max' => 20, |
| 181 |
], |
| 182 |
], |
| 183 |
'default' => [ |
| 184 |
'size' => 6, |
| 185 |
], |
| 186 |
'condition' => [ |
| 187 |
'posts_source!' => 'current_query', |
| 188 |
] |
| 189 |
] |
| 190 |
); |
| 191 |
|
| 192 |
$this->register_query_builder_controls(); |
| 193 |
|
| 194 |
$this->end_controls_section(); |
| 195 |
|
| 196 |
$this->start_controls_section( |
| 197 |
'section_content_additional', |
| 198 |
[ |
| 199 |
'label' => esc_html__('Additional Options', 'ultimate-post-kit'), |
| 200 |
] |
| 201 |
); |
| 202 |
|
| 203 |
//Global Title Controls |
| 204 |
$this->register_title_controls(); |
| 205 |
$this->register_text_controls(); |
| 206 |
|
| 207 |
$this->add_control( |
| 208 |
'show_author_avatar', |
| 209 |
[ |
| 210 |
'label' => esc_html__('Show Author Avatar', 'ultimate-post-kit'), |
| 211 |
'type' => Controls_Manager::SWITCHER, |
| 212 |
'default' => 'yes', |
| 213 |
] |
| 214 |
); |
| 215 |
|
| 216 |
$this->add_control( |
| 217 |
'show_author_name', |
| 218 |
[ |
| 219 |
'label' => esc_html__('Show Author Name', 'ultimate-post-kit'), |
| 220 |
'type' => Controls_Manager::SWITCHER, |
| 221 |
'default' => 'yes', |
| 222 |
] |
| 223 |
); |
| 224 |
|
| 225 |
//Global Date Controls |
| 226 |
$this->register_date_controls(); |
| 227 |
|
| 228 |
//Global Reading Time Controls |
| 229 |
$this->register_reading_time_controls(); |
| 230 |
|
| 231 |
$this->add_control( |
| 232 |
'meta_separator', |
| 233 |
[ |
| 234 |
'label' => __('Separator', 'ultimate-post-kit'), |
| 235 |
'type' => Controls_Manager::TEXT, |
| 236 |
'default' => '/', |
| 237 |
'label_block' => false, |
| 238 |
] |
| 239 |
); |
| 240 |
|
| 241 |
$this->add_control( |
| 242 |
'show_category', |
| 243 |
[ |
| 244 |
'label' => esc_html__('Category', 'ultimate-post-kit'), |
| 245 |
'type' => Controls_Manager::SWITCHER, |
| 246 |
'default' => 'yes', |
| 247 |
'separator' => 'before' |
| 248 |
] |
| 249 |
); |
| 250 |
|
| 251 |
$this->add_control( |
| 252 |
'show_comments', |
| 253 |
[ |
| 254 |
'label' => esc_html__('Show Comments', 'ultimate-post-kit'), |
| 255 |
'type' => Controls_Manager::SWITCHER, |
| 256 |
'default' => 'yes', |
| 257 |
] |
| 258 |
); |
| 259 |
|
| 260 |
$this->add_control( |
| 261 |
'show_readmore', |
| 262 |
[ |
| 263 |
'label' => esc_html__('Show Read More', 'ultimate-post-kit'), |
| 264 |
'type' => Controls_Manager::SWITCHER, |
| 265 |
'default' => 'yes', |
| 266 |
'separator' => 'before' |
| 267 |
] |
| 268 |
); |
| 269 |
|
| 270 |
$this->add_control( |
| 271 |
'readmore_text', |
| 272 |
[ |
| 273 |
'label' => esc_html__('Read More Text', 'ultimate-post-kit'), |
| 274 |
'type' => Controls_Manager::TEXT, |
| 275 |
'dynamic' => [ 'active' => true ], |
| 276 |
'default' => esc_html__('Read More', 'ultimate-post-kit'), |
| 277 |
'placeholder' => esc_html__('Read More', 'ultimate-post-kit'), |
| 278 |
'condition' => [ |
| 279 |
'show_readmore' => 'yes', |
| 280 |
], |
| 281 |
] |
| 282 |
); |
| 283 |
|
| 284 |
$this->add_control( |
| 285 |
'readmore_icon', |
| 286 |
[ |
| 287 |
'label' => esc_html__('Icon', 'ultimate-post-kit'), |
| 288 |
'type' => Controls_Manager::ICONS, |
| 289 |
'label_block' => false, |
| 290 |
'skin' => 'inline', |
| 291 |
'condition' => [ |
| 292 |
'show_readmore' => 'yes', |
| 293 |
] |
| 294 |
] |
| 295 |
); |
| 296 |
|
| 297 |
$this->add_control( |
| 298 |
'icon_align', |
| 299 |
[ |
| 300 |
'label' => esc_html__('Icon Position', 'ultimate-post-kit'), |
| 301 |
'type' => Controls_Manager::SELECT, |
| 302 |
'default' => 'right', |
| 303 |
'options' => [ |
| 304 |
'left' => esc_html__('Left', 'ultimate-post-kit'), |
| 305 |
'right' => esc_html__('Right', 'ultimate-post-kit'), |
| 306 |
], |
| 307 |
'condition' => [ |
| 308 |
'readmore_icon[value]!' => '', |
| 309 |
], |
| 310 |
] |
| 311 |
); |
| 312 |
|
| 313 |
$this->add_control( |
| 314 |
'icon_indent', |
| 315 |
[ |
| 316 |
'label' => esc_html__('Icon Spacing', 'ultimate-post-kit'), |
| 317 |
'type' => Controls_Manager::SLIDER, |
| 318 |
'default' => [ |
| 319 |
'size' => 8, |
| 320 |
], |
| 321 |
'range' => [ |
| 322 |
'px' => [ |
| 323 |
'max' => 50, |
| 324 |
], |
| 325 |
], |
| 326 |
'condition' => [ |
| 327 |
'readmore_icon[value]!' => '', |
| 328 |
], |
| 329 |
'selectors' => [ |
| 330 |
'{{WRAPPER}} .upk-ramble-grid .upk-flex-align-right' => is_rtl() ? 'margin-right: {{SIZE}}{{UNIT}};' : 'margin-left: {{SIZE}}{{UNIT}};', |
| 331 |
'{{WRAPPER}} .upk-ramble-grid .upk-flex-align-left' => is_rtl() ? 'margin-left: {{SIZE}}{{UNIT}};' : 'margin-right: {{SIZE}}{{UNIT}};', |
| 332 |
], |
| 333 |
] |
| 334 |
); |
| 335 |
|
| 336 |
|
| 337 |
$this->add_control( |
| 338 |
'show_pagination', |
| 339 |
[ |
| 340 |
'label' => esc_html__('Show Pagination', 'ultimate-post-kit'), |
| 341 |
'type' => Controls_Manager::SWITCHER, |
| 342 |
'separator' => 'before' |
| 343 |
] |
| 344 |
); |
| 345 |
|
| 346 |
//Global Ajax Controls |
| 347 |
$this->register_ajax_loadmore_controls(); |
| 348 |
|
| 349 |
$this->add_control( |
| 350 |
'global_link', |
| 351 |
[ |
| 352 |
'label' => __('Item Wrapper Link', 'ultimate-post-kit'), |
| 353 |
'type' => Controls_Manager::SWITCHER, |
| 354 |
'prefix_class' => 'upk-global-link-', |
| 355 |
'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'), |
| 356 |
] |
| 357 |
); |
| 358 |
|
| 359 |
$this->end_controls_section(); |
| 360 |
|
| 361 |
//Style |
| 362 |
$this->start_controls_section( |
| 363 |
'upk_section_style', |
| 364 |
[ |
| 365 |
'label' => esc_html__('Items', 'ultimate-post-kit'), |
| 366 |
'tab' => Controls_Manager::TAB_STYLE, |
| 367 |
] |
| 368 |
); |
| 369 |
|
| 370 |
$this->start_controls_tabs('tabs_item_style'); |
| 371 |
|
| 372 |
$this->start_controls_tab( |
| 373 |
'tab_item_normal', |
| 374 |
[ |
| 375 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 376 |
] |
| 377 |
); |
| 378 |
|
| 379 |
$this->add_control( |
| 380 |
'overlay_background', |
| 381 |
[ |
| 382 |
'label' => esc_html__('Overlay Color', 'ultimate-post-kit'), |
| 383 |
'type' => Controls_Manager::COLOR, |
| 384 |
'selectors' => [ |
| 385 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-image-wrap:before' => 'background-color: {{VALUE}};' |
| 386 |
], |
| 387 |
] |
| 388 |
); |
| 389 |
|
| 390 |
$this->add_group_control( |
| 391 |
Group_Control_Border::get_type(), |
| 392 |
[ |
| 393 |
'name' => 'item_border', |
| 394 |
'label' => __('Border', 'ultimate-post-kit'), |
| 395 |
'placeholder' => '1px', |
| 396 |
'default' => '1px', |
| 397 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item', |
| 398 |
] |
| 399 |
); |
| 400 |
|
| 401 |
$this->add_responsive_control( |
| 402 |
'item_border_radius', |
| 403 |
[ |
| 404 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 405 |
'type' => Controls_Manager::DIMENSIONS, |
| 406 |
'size_units' => ['px', '%'], |
| 407 |
'selectors' => [ |
| 408 |
'{{WRAPPER}} .upk-ramble-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 409 |
], |
| 410 |
] |
| 411 |
); |
| 412 |
|
| 413 |
$this->add_group_control( |
| 414 |
Group_Control_Box_Shadow::get_type(), |
| 415 |
[ |
| 416 |
'name' => 'item_box_shadow', |
| 417 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item', |
| 418 |
] |
| 419 |
); |
| 420 |
|
| 421 |
$this->add_responsive_control( |
| 422 |
'content_padding', |
| 423 |
[ |
| 424 |
'label' => __('Content Padding', 'ultimate-post-kit'), |
| 425 |
'type' => Controls_Manager::DIMENSIONS, |
| 426 |
'size_units' => ['px', 'em', '%'], |
| 427 |
'selectors' => [ |
| 428 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-show, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 429 |
], |
| 430 |
'separator' => 'before' |
| 431 |
] |
| 432 |
); |
| 433 |
|
| 434 |
$this->end_controls_tab(); |
| 435 |
|
| 436 |
$this->start_controls_tab( |
| 437 |
'tab_item_hover', |
| 438 |
[ |
| 439 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 440 |
] |
| 441 |
); |
| 442 |
|
| 443 |
$this->add_control( |
| 444 |
'overlay_background_hover', |
| 445 |
[ |
| 446 |
'label' => esc_html__('Overlay Color', 'ultimate-post-kit'), |
| 447 |
'type' => Controls_Manager::COLOR, |
| 448 |
'selectors' => [ |
| 449 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-image-wrap:before' => 'background-color: {{VALUE}};' |
| 450 |
], |
| 451 |
] |
| 452 |
); |
| 453 |
|
| 454 |
$this->add_control( |
| 455 |
'item_border_color_hover', |
| 456 |
[ |
| 457 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 458 |
'type' => Controls_Manager::COLOR, |
| 459 |
'selectors' => [ |
| 460 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover' => 'border-color: {{VALUE}};' |
| 461 |
], |
| 462 |
'condition' => [ |
| 463 |
'item_border_border!' => '' |
| 464 |
] |
| 465 |
] |
| 466 |
); |
| 467 |
|
| 468 |
$this->add_group_control( |
| 469 |
Group_Control_Box_Shadow::get_type(), |
| 470 |
[ |
| 471 |
'name' => 'item_box_shadow_hover', |
| 472 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item:hover', |
| 473 |
] |
| 474 |
); |
| 475 |
|
| 476 |
$this->end_controls_tab(); |
| 477 |
|
| 478 |
$this->end_controls_tabs(); |
| 479 |
|
| 480 |
$this->end_controls_section(); |
| 481 |
|
| 482 |
$this->start_controls_section( |
| 483 |
'section_style_title', |
| 484 |
[ |
| 485 |
'label' => esc_html__('Title', 'ultimate-post-kit'), |
| 486 |
'tab' => Controls_Manager::TAB_STYLE, |
| 487 |
'condition' => [ |
| 488 |
'show_title' => 'yes', |
| 489 |
], |
| 490 |
] |
| 491 |
); |
| 492 |
|
| 493 |
$this->add_control( |
| 494 |
'title_style', |
| 495 |
[ |
| 496 |
'label' => esc_html__('Style', 'ultimate-post-kit'), |
| 497 |
'type' => Controls_Manager::SELECT, |
| 498 |
'default' => 'underline', |
| 499 |
'options' => [ |
| 500 |
'underline' => esc_html__('Underline', 'ultimate-post-kit'), |
| 501 |
'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'), |
| 502 |
'overline' => esc_html__('Overline', 'ultimate-post-kit'), |
| 503 |
'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'), |
| 504 |
], |
| 505 |
] |
| 506 |
); |
| 507 |
|
| 508 |
$this->add_control( |
| 509 |
'title_color', |
| 510 |
[ |
| 511 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 512 |
'type' => Controls_Manager::COLOR, |
| 513 |
'selectors' => [ |
| 514 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title a' => 'color: {{VALUE}};', |
| 515 |
], |
| 516 |
] |
| 517 |
); |
| 518 |
|
| 519 |
$this->add_group_control( |
| 520 |
Group_Control_Typography::get_type(), |
| 521 |
[ |
| 522 |
'name' => 'title_typography', |
| 523 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 524 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title', |
| 525 |
] |
| 526 |
); |
| 527 |
|
| 528 |
$this->add_control( |
| 529 |
'title_advanced_style', |
| 530 |
[ |
| 531 |
'label' => esc_html__('Advanced Style', 'ultimate-post-kit'), |
| 532 |
'type' => Controls_Manager::SWITCHER, |
| 533 |
] |
| 534 |
); |
| 535 |
|
| 536 |
$this->add_control( |
| 537 |
'title_background', |
| 538 |
[ |
| 539 |
'label' => esc_html__('Background', 'ultimate-post-kit'), |
| 540 |
'type' => Controls_Manager::COLOR, |
| 541 |
'selectors' => [ |
| 542 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title' => 'background-color: {{VALUE}};', |
| 543 |
], |
| 544 |
'condition' => [ |
| 545 |
'title_advanced_style' => 'yes' |
| 546 |
] |
| 547 |
] |
| 548 |
); |
| 549 |
|
| 550 |
$this->add_group_control( |
| 551 |
Group_Control_Text_Shadow::get_type(), |
| 552 |
[ |
| 553 |
'name' => 'title_text_shadow', |
| 554 |
'label' => __('Text Shadow', 'ultimate-post-kit'), |
| 555 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title', |
| 556 |
'condition' => [ |
| 557 |
'title_advanced_style' => 'yes' |
| 558 |
] |
| 559 |
] |
| 560 |
); |
| 561 |
|
| 562 |
$this->add_group_control( |
| 563 |
Group_Control_Border::get_type(), |
| 564 |
[ |
| 565 |
'name' => 'title_border', |
| 566 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title', |
| 567 |
'condition' => [ |
| 568 |
'title_advanced_style' => 'yes' |
| 569 |
] |
| 570 |
] |
| 571 |
); |
| 572 |
|
| 573 |
$this->add_responsive_control( |
| 574 |
'title_border_radius', |
| 575 |
[ |
| 576 |
'label' => __('Border Radius', 'ultimate-post-kit'), |
| 577 |
'type' => Controls_Manager::DIMENSIONS, |
| 578 |
'size_units' => ['px', '%'], |
| 579 |
'selectors' => [ |
| 580 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 581 |
], |
| 582 |
'condition' => [ |
| 583 |
'title_advanced_style' => 'yes' |
| 584 |
] |
| 585 |
] |
| 586 |
); |
| 587 |
|
| 588 |
$this->add_group_control( |
| 589 |
Group_Control_Box_Shadow::get_type(), |
| 590 |
[ |
| 591 |
'name' => 'title_box_shadow', |
| 592 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title', |
| 593 |
'condition' => [ |
| 594 |
'title_advanced_style' => 'yes' |
| 595 |
] |
| 596 |
] |
| 597 |
); |
| 598 |
|
| 599 |
$this->add_responsive_control( |
| 600 |
'title_text_padding', |
| 601 |
[ |
| 602 |
'label' => __('Padding', 'ultimate-post-kit'), |
| 603 |
'type' => Controls_Manager::DIMENSIONS, |
| 604 |
'size_units' => ['px', 'em', '%'], |
| 605 |
'selectors' => [ |
| 606 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 607 |
], |
| 608 |
'condition' => [ |
| 609 |
'title_advanced_style' => 'yes' |
| 610 |
] |
| 611 |
] |
| 612 |
); |
| 613 |
|
| 614 |
$this->add_responsive_control( |
| 615 |
'title_text_margtin', |
| 616 |
[ |
| 617 |
'label' => __('Margtin', 'ultimate-post-kit'), |
| 618 |
'type' => Controls_Manager::DIMENSIONS, |
| 619 |
'size_units' => ['px', 'em', '%'], |
| 620 |
'selectors' => [ |
| 621 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-title' => 'margtin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 622 |
], |
| 623 |
'condition' => [ |
| 624 |
'title_advanced_style' => 'yes' |
| 625 |
] |
| 626 |
] |
| 627 |
); |
| 628 |
|
| 629 |
$this->end_controls_section(); |
| 630 |
|
| 631 |
$this->start_controls_section( |
| 632 |
'section_text_style', |
| 633 |
[ |
| 634 |
'label' => esc_html__('Text', 'ultimate-post-kit'), |
| 635 |
'tab' => Controls_Manager::TAB_STYLE, |
| 636 |
'condition' => [ |
| 637 |
'show_excerpt' => 'yes' |
| 638 |
], |
| 639 |
] |
| 640 |
); |
| 641 |
|
| 642 |
$this->add_control( |
| 643 |
'text_color', |
| 644 |
[ |
| 645 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 646 |
'type' => Controls_Manager::COLOR, |
| 647 |
'selectors' => [ |
| 648 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-text' => 'color: {{VALUE}};', |
| 649 |
], |
| 650 |
] |
| 651 |
); |
| 652 |
|
| 653 |
$this->add_group_control( |
| 654 |
Group_Control_Typography::get_type(), |
| 655 |
[ |
| 656 |
'name' => 'text_typography', |
| 657 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 658 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-text', |
| 659 |
] |
| 660 |
); |
| 661 |
|
| 662 |
$this->end_controls_section(); |
| 663 |
|
| 664 |
$this->start_controls_section( |
| 665 |
'section_style_author_date', |
| 666 |
[ |
| 667 |
'label' => esc_html__('Author/Date', 'ultimate-post-kit'), |
| 668 |
'tab' => Controls_Manager::TAB_STYLE, |
| 669 |
'conditions' => [ |
| 670 |
'relation' => 'or', |
| 671 |
'terms' => [ |
| 672 |
[ |
| 673 |
'name' => 'show_author_avatar', |
| 674 |
'value' => 'yes' |
| 675 |
], |
| 676 |
[ |
| 677 |
'name' => 'show_author_name', |
| 678 |
'value' => 'yes' |
| 679 |
], |
| 680 |
[ |
| 681 |
'name' => 'show_date', |
| 682 |
'value' => 'yes' |
| 683 |
] |
| 684 |
] |
| 685 |
], |
| 686 |
] |
| 687 |
); |
| 688 |
|
| 689 |
$this->add_control( |
| 690 |
'author_image_heading', |
| 691 |
[ |
| 692 |
'label' => esc_html__('Author Avatar', 'ultimate-post-kit'), |
| 693 |
'type' => Controls_Manager::HEADING, |
| 694 |
'condition' => [ |
| 695 |
'show_author_avatar' => 'yes' |
| 696 |
] |
| 697 |
] |
| 698 |
); |
| 699 |
|
| 700 |
$this->add_group_control( |
| 701 |
Group_Control_Border::get_type(), |
| 702 |
[ |
| 703 |
'name' => 'author_iamge_border', |
| 704 |
'label' => __('Border', 'ultimate-post-kit'), |
| 705 |
'placeholder' => '1px', |
| 706 |
'default' => '1px', |
| 707 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-meta .upk-author-image img', |
| 708 |
'condition' => [ |
| 709 |
'show_author_avatar' => 'yes' |
| 710 |
] |
| 711 |
] |
| 712 |
); |
| 713 |
|
| 714 |
$this->add_responsive_control( |
| 715 |
'author_iamge_border_radius', |
| 716 |
[ |
| 717 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 718 |
'type' => Controls_Manager::DIMENSIONS, |
| 719 |
'size_units' => ['px', '%'], |
| 720 |
'selectors' => [ |
| 721 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-meta .upk-author-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 722 |
], |
| 723 |
'condition' => [ |
| 724 |
'show_author_avatar' => 'yes' |
| 725 |
] |
| 726 |
] |
| 727 |
); |
| 728 |
|
| 729 |
$this->add_responsive_control( |
| 730 |
'author_iamge_size', |
| 731 |
[ |
| 732 |
'label' => esc_html__('Size', 'ultimate-post-kit'), |
| 733 |
'type' => Controls_Manager::SLIDER, |
| 734 |
'selectors' => [ |
| 735 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-meta .upk-author-image img' => 'height: {{SIZE}}{{UNIT}}; width: {{SIZE}}{{UNIT}};', |
| 736 |
], |
| 737 |
'condition' => [ |
| 738 |
'show_author_avatar' => 'yes' |
| 739 |
] |
| 740 |
] |
| 741 |
); |
| 742 |
|
| 743 |
$this->add_responsive_control( |
| 744 |
'author_iamge_spacing', |
| 745 |
[ |
| 746 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 747 |
'type' => Controls_Manager::SLIDER, |
| 748 |
'selectors' => [ |
| 749 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-meta .upk-author-image' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 750 |
], |
| 751 |
'condition' => [ |
| 752 |
'show_author_avatar' => 'yes' |
| 753 |
] |
| 754 |
] |
| 755 |
); |
| 756 |
|
| 757 |
$this->add_control( |
| 758 |
'author_heading', |
| 759 |
[ |
| 760 |
'label' => esc_html__('Author Name', 'ultimate-post-kit'), |
| 761 |
'type' => Controls_Manager::HEADING, |
| 762 |
'separator' => 'before', |
| 763 |
'condition' => [ |
| 764 |
'show_author_name' => 'yes' |
| 765 |
] |
| 766 |
] |
| 767 |
); |
| 768 |
|
| 769 |
$this->add_control( |
| 770 |
'author_color', |
| 771 |
[ |
| 772 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 773 |
'type' => Controls_Manager::COLOR, |
| 774 |
'selectors' => [ |
| 775 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-author-name a' => 'color: {{VALUE}};', |
| 776 |
], |
| 777 |
'condition' => [ |
| 778 |
'show_author_name' => 'yes' |
| 779 |
] |
| 780 |
] |
| 781 |
); |
| 782 |
|
| 783 |
$this->add_control( |
| 784 |
'author_hover_color', |
| 785 |
[ |
| 786 |
'label' => esc_html__('Hover Color', 'ultimate-post-kit'), |
| 787 |
'type' => Controls_Manager::COLOR, |
| 788 |
'selectors' => [ |
| 789 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-author-name a:hover' => 'color: {{VALUE}};', |
| 790 |
], |
| 791 |
'condition' => [ |
| 792 |
'show_author_name' => 'yes' |
| 793 |
] |
| 794 |
] |
| 795 |
); |
| 796 |
|
| 797 |
$this->add_group_control( |
| 798 |
Group_Control_Typography::get_type(), |
| 799 |
[ |
| 800 |
'name' => 'author_typography', |
| 801 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 802 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-author-name a', |
| 803 |
'condition' => [ |
| 804 |
'show_author_name' => 'yes' |
| 805 |
] |
| 806 |
] |
| 807 |
); |
| 808 |
|
| 809 |
$this->add_control( |
| 810 |
'date_heading', |
| 811 |
[ |
| 812 |
'label' => esc_html__('Date/Time', 'ultimate-post-kit'), |
| 813 |
'type' => Controls_Manager::HEADING, |
| 814 |
'separator' => 'before', |
| 815 |
'conditions' => [ |
| 816 |
'relation' => 'or', |
| 817 |
'terms' => [ |
| 818 |
[ |
| 819 |
'name' => 'show_date', |
| 820 |
'value' => 'yes' |
| 821 |
], |
| 822 |
[ |
| 823 |
'name' => 'show_reading_time', |
| 824 |
'value' => 'yes' |
| 825 |
] |
| 826 |
] |
| 827 |
], |
| 828 |
] |
| 829 |
); |
| 830 |
|
| 831 |
$this->add_control( |
| 832 |
'date_color', |
| 833 |
[ |
| 834 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 835 |
'type' => Controls_Manager::COLOR, |
| 836 |
'selectors' => [ |
| 837 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide .upk-date, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide .upk-post-time, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-reading-time' => 'color: {{VALUE}};', |
| 838 |
], |
| 839 |
'conditions' => [ |
| 840 |
'relation' => 'or', |
| 841 |
'terms' => [ |
| 842 |
[ |
| 843 |
'name' => 'show_date', |
| 844 |
'value' => 'yes' |
| 845 |
], |
| 846 |
[ |
| 847 |
'name' => 'show_reading_time', |
| 848 |
'value' => 'yes' |
| 849 |
] |
| 850 |
] |
| 851 |
], |
| 852 |
] |
| 853 |
); |
| 854 |
|
| 855 |
$this->add_group_control( |
| 856 |
Group_Control_Typography::get_type(), |
| 857 |
[ |
| 858 |
'name' => 'date_typography', |
| 859 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 860 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide .upk-date, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide .upk-post-time, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-reading-time', |
| 861 |
'conditions' => [ |
| 862 |
'relation' => 'or', |
| 863 |
'terms' => [ |
| 864 |
[ |
| 865 |
'name' => 'show_date', |
| 866 |
'value' => 'yes' |
| 867 |
], |
| 868 |
[ |
| 869 |
'name' => 'show_reading_time', |
| 870 |
'value' => 'yes' |
| 871 |
] |
| 872 |
] |
| 873 |
], |
| 874 |
] |
| 875 |
); |
| 876 |
|
| 877 |
$this->add_responsive_control( |
| 878 |
'date_spacing', |
| 879 |
[ |
| 880 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 881 |
'type' => Controls_Manager::SLIDER, |
| 882 |
'selectors' => [ |
| 883 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-default-hide .upk-date' => 'margin-top: {{SIZE}}{{UNIT}};', |
| 884 |
], |
| 885 |
'condition' => [ |
| 886 |
'show_date' => 'yes' |
| 887 |
] |
| 888 |
] |
| 889 |
); |
| 890 |
|
| 891 |
$this->add_responsive_control( |
| 892 |
'meta_space_between', |
| 893 |
[ |
| 894 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 895 |
'type' => Controls_Manager::SLIDER, |
| 896 |
'range' => [ |
| 897 |
'px' => [ |
| 898 |
'min' => 0, |
| 899 |
'max' => 50, |
| 900 |
], |
| 901 |
], |
| 902 |
'selectors' => [ |
| 903 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-reading-time > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};', |
| 904 |
], |
| 905 |
'conditions' => [ |
| 906 |
'relation' => 'or', |
| 907 |
'terms' => [ |
| 908 |
[ |
| 909 |
'name' => 'show_date', |
| 910 |
'value' => 'yes' |
| 911 |
], |
| 912 |
[ |
| 913 |
'name' => 'show_reading_time', |
| 914 |
'value' => 'yes' |
| 915 |
] |
| 916 |
] |
| 917 |
], |
| 918 |
] |
| 919 |
); |
| 920 |
|
| 921 |
$this->end_controls_section(); |
| 922 |
|
| 923 |
$this->start_controls_section( |
| 924 |
'section_style_category', |
| 925 |
[ |
| 926 |
'label' => esc_html__('Category/Date', 'ultimate-post-kit'), |
| 927 |
'tab' => Controls_Manager::TAB_STYLE, |
| 928 |
'conditions' => [ |
| 929 |
'relation' => 'or', |
| 930 |
'terms' => [ |
| 931 |
[ |
| 932 |
'name' => 'show_category', |
| 933 |
'value' => 'yes' |
| 934 |
], |
| 935 |
[ |
| 936 |
'name' => 'show_date', |
| 937 |
'value' => 'yes' |
| 938 |
] |
| 939 |
] |
| 940 |
], |
| 941 |
] |
| 942 |
); |
| 943 |
|
| 944 |
$this->add_control( |
| 945 |
'category_date_color', |
| 946 |
[ |
| 947 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 948 |
'type' => Controls_Manager::COLOR, |
| 949 |
'selectors' => [ |
| 950 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-date, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-category a, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-post-time' => 'color: {{VALUE}};', |
| 951 |
], |
| 952 |
] |
| 953 |
); |
| 954 |
|
| 955 |
$this->add_control( |
| 956 |
'category_date_divider_color', |
| 957 |
[ |
| 958 |
'label' => esc_html__('Divider Color', 'ultimate-post-kit'), |
| 959 |
'type' => Controls_Manager::COLOR, |
| 960 |
'selectors' => [ |
| 961 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-category:before' => 'background: {{VALUE}};', |
| 962 |
], |
| 963 |
'condition' => [ |
| 964 |
'show_category' => 'yes' |
| 965 |
] |
| 966 |
] |
| 967 |
); |
| 968 |
|
| 969 |
$this->add_responsive_control( |
| 970 |
'category_date_spacing', |
| 971 |
[ |
| 972 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 973 |
'type' => Controls_Manager::SLIDER, |
| 974 |
'selectors' => [ |
| 975 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-category' => 'margin-left: {{SIZE}}{{UNIT}}; padding-left: {{SIZE}}{{UNIT}};', |
| 976 |
], |
| 977 |
'condition' => [ |
| 978 |
'show_category' => 'yes' |
| 979 |
] |
| 980 |
] |
| 981 |
); |
| 982 |
|
| 983 |
$this->add_responsive_control( |
| 984 |
'category_spacing', |
| 985 |
[ |
| 986 |
'label' => esc_html__('Category Space Beween', 'ultimate-post-kit'), |
| 987 |
'type' => Controls_Manager::SLIDER, |
| 988 |
'range' => [ |
| 989 |
'px' => [ |
| 990 |
'min' => 0, |
| 991 |
'max' => 50, |
| 992 |
'step' => 2, |
| 993 |
], |
| 994 |
], |
| 995 |
'selectors' => [ |
| 996 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-category a+a' => 'margin-left: {{SIZE}}{{UNIT}};', |
| 997 |
], |
| 998 |
'condition' => [ |
| 999 |
'show_category' => 'yes' |
| 1000 |
] |
| 1001 |
] |
| 1002 |
); |
| 1003 |
|
| 1004 |
$this->add_group_control( |
| 1005 |
Group_Control_Typography::get_type(), |
| 1006 |
[ |
| 1007 |
'name' => 'category_date_typography', |
| 1008 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1009 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-date, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-category a, {{WRAPPER}} .upk-ramble-grid .upk-item .upk-date-cetagory-wrap .upk-post-time', |
| 1010 |
] |
| 1011 |
); |
| 1012 |
|
| 1013 |
$this->end_controls_section(); |
| 1014 |
|
| 1015 |
$this->start_controls_section( |
| 1016 |
'section_style_readmore', |
| 1017 |
[ |
| 1018 |
'label' => __('Read More', 'ultimate-post-kit'), |
| 1019 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1020 |
'condition' => [ |
| 1021 |
'show_readmore' => 'yes', |
| 1022 |
], |
| 1023 |
] |
| 1024 |
); |
| 1025 |
|
| 1026 |
$this->start_controls_tabs('tabs_readmore_style'); |
| 1027 |
|
| 1028 |
$this->start_controls_tab( |
| 1029 |
'tab_readmore_normal', |
| 1030 |
[ |
| 1031 |
'label' => __('Normal', 'ultimate-post-kit'), |
| 1032 |
] |
| 1033 |
); |
| 1034 |
|
| 1035 |
$this->add_control( |
| 1036 |
'readmore_text_color', |
| 1037 |
[ |
| 1038 |
'label' => __('Color', 'ultimate-post-kit'), |
| 1039 |
'type' => Controls_Manager::COLOR, |
| 1040 |
'selectors' => [ |
| 1041 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore' => 'color: {{VALUE}};', |
| 1042 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore svg *' => 'fill: {{VALUE}};', |
| 1043 |
], |
| 1044 |
] |
| 1045 |
); |
| 1046 |
|
| 1047 |
$this->add_group_control( |
| 1048 |
Group_Control_Background::get_type(), |
| 1049 |
[ |
| 1050 |
'name' => 'readmore_background', |
| 1051 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore', |
| 1052 |
] |
| 1053 |
); |
| 1054 |
|
| 1055 |
$this->add_group_control( |
| 1056 |
Group_Control_Border::get_type(), |
| 1057 |
[ |
| 1058 |
'name' => 'readmore_border', |
| 1059 |
'placeholder' => '1px', |
| 1060 |
'default' => '1px', |
| 1061 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore' |
| 1062 |
] |
| 1063 |
); |
| 1064 |
|
| 1065 |
$this->add_responsive_control( |
| 1066 |
'readmore_radius', |
| 1067 |
[ |
| 1068 |
'label' => __('Border Radius', 'ultimate-post-kit'), |
| 1069 |
'type' => Controls_Manager::DIMENSIONS, |
| 1070 |
'size_units' => ['px', '%'], |
| 1071 |
'selectors' => [ |
| 1072 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1073 |
], |
| 1074 |
] |
| 1075 |
); |
| 1076 |
|
| 1077 |
$this->add_responsive_control( |
| 1078 |
'readmore_padding', |
| 1079 |
[ |
| 1080 |
'label' => __('Padding', 'ultimate-post-kit'), |
| 1081 |
'type' => Controls_Manager::DIMENSIONS, |
| 1082 |
'size_units' => ['px', 'em', '%'], |
| 1083 |
'selectors' => [ |
| 1084 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1085 |
], |
| 1086 |
] |
| 1087 |
); |
| 1088 |
|
| 1089 |
$this->add_responsive_control( |
| 1090 |
'readmore_margin', |
| 1091 |
[ |
| 1092 |
'label' => __('Margin', 'ultimate-post-kit'), |
| 1093 |
'type' => Controls_Manager::DIMENSIONS, |
| 1094 |
'size_units' => ['px', 'em', '%'], |
| 1095 |
'selectors' => [ |
| 1096 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1097 |
], |
| 1098 |
] |
| 1099 |
); |
| 1100 |
|
| 1101 |
$this->add_group_control( |
| 1102 |
Group_Control_Box_Shadow::get_type(), |
| 1103 |
[ |
| 1104 |
'name' => 'readmore_shadow', |
| 1105 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore', |
| 1106 |
] |
| 1107 |
); |
| 1108 |
|
| 1109 |
$this->add_group_control( |
| 1110 |
Group_Control_Typography::get_type(), |
| 1111 |
[ |
| 1112 |
'name' => 'readmore_typography', |
| 1113 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-readmore', |
| 1114 |
] |
| 1115 |
); |
| 1116 |
|
| 1117 |
$this->end_controls_tab(); |
| 1118 |
|
| 1119 |
$this->start_controls_tab( |
| 1120 |
'tab_readmore_hover', |
| 1121 |
[ |
| 1122 |
'label' => __('Hover', 'ultimate-post-kit'), |
| 1123 |
] |
| 1124 |
); |
| 1125 |
|
| 1126 |
$this->add_control( |
| 1127 |
'readmore_hover_text_color', |
| 1128 |
[ |
| 1129 |
'label' => __('Color', 'ultimate-post-kit'), |
| 1130 |
'type' => Controls_Manager::COLOR, |
| 1131 |
'selectors' => [ |
| 1132 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-readmore' => 'color: {{VALUE}};', |
| 1133 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-readmore svg *' => 'fill: {{VALUE}};', |
| 1134 |
], |
| 1135 |
] |
| 1136 |
); |
| 1137 |
|
| 1138 |
$this->add_group_control( |
| 1139 |
Group_Control_Background::get_type(), |
| 1140 |
[ |
| 1141 |
'name' => 'readmore_hover_background', |
| 1142 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-readmore', |
| 1143 |
] |
| 1144 |
); |
| 1145 |
|
| 1146 |
$this->add_control( |
| 1147 |
'readmore_hover_border_color', |
| 1148 |
[ |
| 1149 |
'label' => __('Border Color', 'ultimate-post-kit'), |
| 1150 |
'type' => Controls_Manager::COLOR, |
| 1151 |
'selectors' => [ |
| 1152 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-readmore' => 'border-color: {{VALUE}};', |
| 1153 |
], |
| 1154 |
'condition' => [ |
| 1155 |
'readmore_border_border!' => '' |
| 1156 |
] |
| 1157 |
] |
| 1158 |
); |
| 1159 |
|
| 1160 |
$this->add_group_control( |
| 1161 |
Group_Control_Box_Shadow::get_type(), |
| 1162 |
[ |
| 1163 |
'name' => 'readmore_hover_shadow', |
| 1164 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-readmore', |
| 1165 |
] |
| 1166 |
); |
| 1167 |
|
| 1168 |
$this->add_control( |
| 1169 |
'readmore_hover_animation', |
| 1170 |
[ |
| 1171 |
'label' => __('Hover Animation', 'ultimate-post-kit'), |
| 1172 |
'type' => Controls_Manager::HOVER_ANIMATION, |
| 1173 |
] |
| 1174 |
); |
| 1175 |
|
| 1176 |
$this->end_controls_tab(); |
| 1177 |
|
| 1178 |
$this->end_controls_tabs(); |
| 1179 |
|
| 1180 |
$this->end_controls_section(); |
| 1181 |
|
| 1182 |
$this->start_controls_section( |
| 1183 |
'section_comments_style', |
| 1184 |
[ |
| 1185 |
'label' => esc_html__('Comments', 'ultimate-post-kit'), |
| 1186 |
'tab' => Controls_Manager::TAB_STYLE, |
| 1187 |
'condition' => [ |
| 1188 |
'show_comments' => 'yes' |
| 1189 |
], |
| 1190 |
] |
| 1191 |
); |
| 1192 |
|
| 1193 |
$this->add_control( |
| 1194 |
'comments_color', |
| 1195 |
[ |
| 1196 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1197 |
'type' => Controls_Manager::COLOR, |
| 1198 |
'selectors' => [ |
| 1199 |
'{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-comments' => 'color: {{VALUE}};', |
| 1200 |
], |
| 1201 |
] |
| 1202 |
); |
| 1203 |
|
| 1204 |
$this->add_control( |
| 1205 |
'comments_hover_color', |
| 1206 |
[ |
| 1207 |
'label' => esc_html__('Hover Color', 'ultimate-post-kit'), |
| 1208 |
'type' => Controls_Manager::COLOR, |
| 1209 |
'selectors' => [ |
| 1210 |
'{{WRAPPER}} .upk-ramble-grid .upk-item:hover .upk-btn-comments-wrap .upk-comments' => 'color: {{VALUE}};', |
| 1211 |
], |
| 1212 |
] |
| 1213 |
); |
| 1214 |
|
| 1215 |
$this->add_group_control( |
| 1216 |
Group_Control_Typography::get_type(), |
| 1217 |
[ |
| 1218 |
'name' => 'comments_typography', |
| 1219 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 1220 |
'selector' => '{{WRAPPER}} .upk-ramble-grid .upk-item .upk-btn-comments-wrap .upk-comments', |
| 1221 |
] |
| 1222 |
); |
| 1223 |
|
| 1224 |
$this->end_controls_section(); |
| 1225 |
|
| 1226 |
//Global Pagination Controls |
| 1227 |
$this->register_pagination_controls(); |
| 1228 |
|
| 1229 |
//Global Ajax Loadmore Controls |
| 1230 |
$this->register_ajax_loadmore_style_controls(); |
| 1231 |
} |
| 1232 |
|
| 1233 |
/** |
| 1234 |
* Get post query builder arguments |
| 1235 |
*/ |
| 1236 |
public function query_posts( $posts_per_page ) { |
| 1237 |
$settings = $this->get_settings(); |
| 1238 |
$posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0; |
| 1239 |
$args = $this->getGroupControlQueryArgs(); |
| 1240 |
$is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' ); |
| 1241 |
|
| 1242 |
if ( $is_current_query ) { |
| 1243 |
unset( $args['offset'] ); |
| 1244 |
unset( $args['no_found_rows'] ); |
| 1245 |
$posts_per_page = 0; |
| 1246 |
} |
| 1247 |
|
| 1248 |
if ( $posts_per_page > 0 ) { |
| 1249 |
$args['posts_per_page'] = $posts_per_page; |
| 1250 |
} else { |
| 1251 |
$args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 ); |
| 1252 |
} |
| 1253 |
|
| 1254 |
if ( $settings['show_pagination'] ) { |
| 1255 |
$args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) ); |
| 1256 |
} |
| 1257 |
|
| 1258 |
$this->_query = new \WP_Query( $args ); |
| 1259 |
} |
| 1260 |
|
| 1261 |
public function render_post_meta() { |
| 1262 |
$settings = $this->get_settings_for_display(); |
| 1263 |
|
| 1264 |
?> |
| 1265 |
<?php if ($settings['show_author_avatar'] or $settings['show_author_name'] or $settings['show_date']) : ?> |
| 1266 |
<div class="upk-meta"> |
| 1267 |
|
| 1268 |
<?php if ($settings['show_author_avatar']) : ?> |
| 1269 |
<div class="upk-author-image"> |
| 1270 |
<?php echo get_avatar(get_the_author_meta('ID'), 48); ?> |
| 1271 |
</div> |
| 1272 |
<?php endif; ?> |
| 1273 |
|
| 1274 |
<div class="upk-author-name-date-wrap"> |
| 1275 |
|
| 1276 |
<?php if ($settings['show_author_name']) : ?> |
| 1277 |
<div class="upk-author-name"> |
| 1278 |
<a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"><?php echo esc_html( get_the_author() ); ?></a> |
| 1279 |
</div> |
| 1280 |
<?php endif; ?> |
| 1281 |
|
| 1282 |
<?php if ($settings['show_date'] or $settings['show_reading_time']) : ?> |
| 1283 |
<div class="upk-date-reading-time upk-flex upk-flex-middle"> |
| 1284 |
<?php if ($settings['show_date'] == 'yes') : ?> |
| 1285 |
<div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1286 |
<?php $this->render_date(); ?> |
| 1287 |
</div> |
| 1288 |
<?php endif; ?> |
| 1289 |
|
| 1290 |
<?php if (_is_upk_pro_activated()) : |
| 1291 |
if ('yes' === $settings['show_reading_time']) : ?> |
| 1292 |
<div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1293 |
<?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?> |
| 1294 |
</div> |
| 1295 |
<?php endif; ?> |
| 1296 |
<?php endif; ?> |
| 1297 |
|
| 1298 |
</div> |
| 1299 |
<?php endif; ?> |
| 1300 |
|
| 1301 |
</div> |
| 1302 |
|
| 1303 |
</div> |
| 1304 |
<?php endif; ?> |
| 1305 |
|
| 1306 |
<?php |
| 1307 |
} |
| 1308 |
|
| 1309 |
public function render_comments($id = 0) { |
| 1310 |
|
| 1311 |
if (!$this->get_settings('show_comments')) { |
| 1312 |
return; |
| 1313 |
} |
| 1314 |
?> |
| 1315 |
|
| 1316 |
<div class="upk-comments"> |
| 1317 |
<?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?> |
| 1318 |
</div> |
| 1319 |
|
| 1320 |
<?php |
| 1321 |
} |
| 1322 |
|
| 1323 |
public function render_readmore() { |
| 1324 |
$settings = $this->get_settings_for_display(); |
| 1325 |
|
| 1326 |
if (!$this->get_settings('show_readmore')) { |
| 1327 |
return; |
| 1328 |
} |
| 1329 |
|
| 1330 |
$animation = ($this->get_settings('readmore_hover_animation')) ? ' elementor-animation-' . $this->get_settings('readmore_hover_animation') : ''; |
| 1331 |
|
| 1332 |
?> |
| 1333 |
<a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore <?php echo esc_html($animation); ?>"> |
| 1334 |
<span class="upk-flex upk-flex-middle"> |
| 1335 |
<?php echo esc_html($this->get_settings('readmore_text')); ?> |
| 1336 |
|
| 1337 |
<?php if ($settings['readmore_icon']['value']) : ?> |
| 1338 |
<span class="upk-readmore-btn-icon upk-flex-align-<?php echo esc_html($this->get_settings('icon_align')); ?>"> |
| 1339 |
|
| 1340 |
<?php Icons_Manager::render_icon($settings['readmore_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?> |
| 1341 |
|
| 1342 |
</span> |
| 1343 |
<?php endif; ?> |
| 1344 |
</span> |
| 1345 |
</a> |
| 1346 |
<?php |
| 1347 |
} |
| 1348 |
|
| 1349 |
public function render_post_grid_item($post_id, $image_size, $excerpt_length) { |
| 1350 |
$settings = $this->get_settings_for_display(); |
| 1351 |
|
| 1352 |
if ('yes' == $settings['global_link']) { |
| 1353 |
|
| 1354 |
$this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true); |
| 1355 |
} |
| 1356 |
$this->add_render_attribute('grid-item', 'class', 'upk-item', true); |
| 1357 |
|
| 1358 |
?> |
| 1359 |
<div <?php $this->print_render_attribute_string('grid-item'); ?>> |
| 1360 |
<div class="upk-image-wrap"> |
| 1361 |
<?php $this->render_image(get_post_thumbnail_id($post_id), $image_size); ?> |
| 1362 |
|
| 1363 |
<div class="upk-content"> |
| 1364 |
|
| 1365 |
<div class="upk-default-show"> |
| 1366 |
<div class="upk-date-cetagory-wrap"> |
| 1367 |
<?php $this->render_date(); ?> |
| 1368 |
<?php $this->render_category(); ?> |
| 1369 |
</div> |
| 1370 |
|
| 1371 |
<?php $this->render_title(substr($this->get_name(), 4)); ?> |
| 1372 |
</div> |
| 1373 |
|
| 1374 |
<div class="upk-default-hide"> |
| 1375 |
<?php $this->render_post_meta(); ?> |
| 1376 |
<?php $this->render_excerpt($excerpt_length); ?> |
| 1377 |
</div> |
| 1378 |
|
| 1379 |
</div> |
| 1380 |
<div class="upk-btn-comments-wrap"> |
| 1381 |
<div class="upk-btn-wrap upk-flex"> |
| 1382 |
<?php $this->render_readmore(); ?> |
| 1383 |
</div> |
| 1384 |
<?php $this->render_comments($post_id); ?> |
| 1385 |
</div> |
| 1386 |
</div> |
| 1387 |
</div> |
| 1388 |
<?php |
| 1389 |
} |
| 1390 |
|
| 1391 |
protected function render() { |
| 1392 |
$settings = $this->get_settings_for_display(); |
| 1393 |
|
| 1394 |
$this->query_posts($settings['item_limit']['size']); |
| 1395 |
$wp_query = $this->get_query(); |
| 1396 |
|
| 1397 |
if (!$wp_query->found_posts) { |
| 1398 |
return; |
| 1399 |
} |
| 1400 |
|
| 1401 |
$this->add_render_attribute('grid-wrap', 'class', 'upk-post-wrap upk-ajax-grid-wrap'); |
| 1402 |
$this->add_render_attribute( |
| 1403 |
[ |
| 1404 |
'upk-ramble-grid' => [ |
| 1405 |
'class' => 'upk-ramble-grid upk-ajax-grid', |
| 1406 |
'data-loadmore' => [ |
| 1407 |
wp_json_encode( |
| 1408 |
array_filter([ |
| 1409 |
'loadmore_enable' => $settings['ajax_loadmore_enable'], |
| 1410 |
'loadmore_btn' => $settings['ajax_loadmore_btn'], |
| 1411 |
'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'], |
| 1412 |
]) |
| 1413 |
) |
| 1414 |
] |
| 1415 |
] |
| 1416 |
] |
| 1417 |
); |
| 1418 |
|
| 1419 |
if ($settings['ajax_loadmore_enable'] == 'yes') { |
| 1420 |
$ajax_settings = [ |
| 1421 |
'posts_source' => isset($settings['posts_source']) ? $settings['posts_source'] : 'post', |
| 1422 |
'posts_per_page' => isset($posts_load) ? $posts_load : 6, |
| 1423 |
'ajax_item_load' => isset($settings['ajax_loadmore_items']) ? $settings['ajax_loadmore_items'] : 3, |
| 1424 |
'posts_selected_ids' => isset($settings['posts_selected_ids']) ? $settings['posts_selected_ids'] : '', |
| 1425 |
'posts_include_by' => isset($settings['posts_include_by']) ? $settings['posts_include_by'] : [], |
| 1426 |
'posts_include_author_ids' => isset($settings['posts_include_author_ids']) ? $settings['posts_include_author_ids'] : '', |
| 1427 |
'posts_include_term_ids' => isset($settings['posts_include_term_ids']) ? $settings['posts_include_term_ids'] : '', |
| 1428 |
'posts_exclude_by' => isset($settings['posts_exclude_by']) ? $settings['posts_exclude_by'] : [], |
| 1429 |
'posts_exclude_ids' => isset($settings['posts_exclude_ids']) ? $settings['posts_exclude_ids'] : '', |
| 1430 |
'posts_exclude_author_ids' => isset($settings['posts_exclude_author_ids']) ? $settings['posts_exclude_author_ids'] : '', |
| 1431 |
'posts_exclude_term_ids' => isset($settings['posts_exclude_term_ids']) ? $settings['posts_exclude_term_ids'] : '', |
| 1432 |
'posts_offset' => isset($settings['posts_offset']) ? $settings['posts_offset'] : 0, |
| 1433 |
'posts_select_date' => isset($settings['posts_select_date']) ? $settings['posts_select_date'] : '', |
| 1434 |
'posts_date_before' => isset($settings['posts_date_before']) ? $settings['posts_date_before'] : '', |
| 1435 |
'posts_date_after' => isset($settings['posts_date_after']) ? $settings['posts_date_after'] : '', |
| 1436 |
'posts_orderby' => isset($settings['posts_orderby']) ? $settings['posts_orderby'] : 'date', |
| 1437 |
'posts_order' => isset($settings['posts_order']) ? $settings['posts_order'] : 'DESC', |
| 1438 |
'posts_ignore_sticky_posts' => isset($settings['posts_ignore_sticky_posts']) ? $settings['posts_ignore_sticky_posts'] : 'no', |
| 1439 |
'posts_only_with_featured_image' => isset($settings['posts_only_with_featured_image']) ? $settings['posts_only_with_featured_image'] : 'no', |
| 1440 |
// Grid Settings |
| 1441 |
'show_title' => isset($settings['show_title']) ? $settings['show_title'] : 'yes', |
| 1442 |
'title_tags' => isset($settings['title_tags']) ? $settings['title_tags'] : 'h3', |
| 1443 |
'title_style' => isset($settings['title_style']) ? $settings['title_style'] : 'underline', |
| 1444 |
'show_excerpt' => isset($settings['show_excerpt']) ? $settings['show_excerpt'] : 'yes', |
| 1445 |
'show_author_avatar' => isset($settings['show_author_avatar']) ? $settings['show_author_avatar'] : 'yes', |
| 1446 |
'show_author_name' => isset($settings['show_author_name']) ? $settings['show_author_name'] : 'yes', |
| 1447 |
'show_date' => isset($settings['show_date']) ? $settings['show_date'] : 'yes', |
| 1448 |
'show_time' => isset($settings['show_time']) ? $settings['show_time'] : 'no', |
| 1449 |
'show_category' => isset($settings['show_category']) ? $settings['show_category'] : 'yes', |
| 1450 |
'show_comments' => isset($settings['show_comments']) ? $settings['show_comments'] : 'yes', |
| 1451 |
'show_readmore' => isset($settings['show_readmore']) ? $settings['show_readmore'] : 'yes', |
| 1452 |
'readmore_text' => isset($settings['readmore_text']) ? $settings['readmore_text'] : 'Read More', |
| 1453 |
'readmore_icon' => isset($settings['readmore_icon']) ? $settings['readmore_icon'] : '', |
| 1454 |
'icon_align' => isset($settings['icon_align']) ? $settings['icon_align'] : 'right', |
| 1455 |
'readmore_hover_animation' => isset($settings['readmore_hover_animation']) ? $settings['readmore_hover_animation'] : '', |
| 1456 |
'show_post_format' => isset($settings['show_post_format']) ? $settings['show_post_format'] : 'yes', |
| 1457 |
'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no', |
| 1458 |
'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no', |
| 1459 |
'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200, |
| 1460 |
'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no', |
| 1461 |
'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no', |
| 1462 |
'meta_separator' => isset($settings['meta_separator']) ? $settings['meta_separator'] : '|', |
| 1463 |
'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no', |
| 1464 |
'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no', |
| 1465 |
'excerpt_length' => isset($settings['excerpt_length']) ? $settings['excerpt_length'] : 20, |
| 1466 |
'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no', |
| 1467 |
]; |
| 1468 |
|
| 1469 |
$this->add_render_attribute( |
| 1470 |
[ |
| 1471 |
'upk-ramble-grid' => [ |
| 1472 |
'data-settings' => [ |
| 1473 |
wp_json_encode($ajax_settings) |
| 1474 |
] |
| 1475 |
] |
| 1476 |
] |
| 1477 |
); |
| 1478 |
} |
| 1479 |
|
| 1480 |
if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) { |
| 1481 |
$this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation'); |
| 1482 |
if (isset($settings['upk_in_animation_delay']['size'])) { |
| 1483 |
$this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']); |
| 1484 |
} |
| 1485 |
} |
| 1486 |
|
| 1487 |
?> |
| 1488 |
<div <?php $this->print_render_attribute_string('upk-ramble-grid'); ?>> |
| 1489 |
<div <?php $this->print_render_attribute_string('grid-wrap'); ?>> |
| 1490 |
|
| 1491 |
<?php while ($wp_query->have_posts()) : |
| 1492 |
$wp_query->the_post(); |
| 1493 |
|
| 1494 |
$thumbnail_size = $settings['primary_thumbnail_size']; |
| 1495 |
|
| 1496 |
?> |
| 1497 |
|
| 1498 |
<?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $settings['excerpt_length']); ?> |
| 1499 |
|
| 1500 |
<?php endwhile; ?> |
| 1501 |
|
| 1502 |
</div> |
| 1503 |
</div> |
| 1504 |
|
| 1505 |
<?php $this->render_ajax_loadmore(); ?> |
| 1506 |
|
| 1507 |
<?php |
| 1508 |
|
| 1509 |
if ($settings['show_pagination']) { ?> |
| 1510 |
<div class="ep-pagination"> |
| 1511 |
<?php ultimate_post_kit_post_pagination($wp_query, $this->get_id()); ?> |
| 1512 |
</div> |
| 1513 |
<?php |
| 1514 |
} |
| 1515 |
wp_reset_postdata(); |
| 1516 |
} |
| 1517 |
} |
| 1518 |
|