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