| 1 |
<?php |
| 2 |
|
| 3 |
namespace UltimatePostKit\Modules\AmoxGrid\Widgets; |
| 4 |
|
| 5 |
use Elementor\Controls_Manager; |
| 6 |
use Elementor\Group_Control_Background; |
| 7 |
use Elementor\Group_Control_Border; |
| 8 |
use Elementor\Group_Control_Box_Shadow; |
| 9 |
use Elementor\Group_Control_Image_Size; |
| 10 |
use Elementor\Group_Control_Text_Shadow; |
| 11 |
use Elementor\Group_Control_Typography; |
| 12 |
use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query; |
| 13 |
use UltimatePostKit\Traits\Global_Widget_Controls; |
| 14 |
use UltimatePostKit\Traits\Global_Widget_Functions; |
| 15 |
use WP_Query; |
| 16 |
|
| 17 |
if (!defined('ABSPATH')) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
// Exit if accessed directly |
| 21 |
|
| 22 |
class Amox_Grid extends Group_Control_Query |
| 23 |
{ |
| 24 |
|
| 25 |
use Global_Widget_Controls; |
| 26 |
use Global_Widget_Functions; |
| 27 |
|
| 28 |
private $_query = null; |
| 29 |
|
| 30 |
public function get_name() |
| 31 |
{ |
| 32 |
return 'upk-amox-grid'; |
| 33 |
} |
| 34 |
|
| 35 |
public function get_title() |
| 36 |
{ |
| 37 |
return BDTUPK . esc_html__('Amox Grid', 'ultimate-post-kit'); |
| 38 |
} |
| 39 |
|
| 40 |
public function get_icon() |
| 41 |
{ |
| 42 |
return 'upk-widget-icon upk-icon-amox-grid'; |
| 43 |
} |
| 44 |
|
| 45 |
public function get_categories() |
| 46 |
{ |
| 47 |
return ['ultimate-post-kit']; |
| 48 |
} |
| 49 |
|
| 50 |
public function get_keywords() |
| 51 |
{ |
| 52 |
return ['post', 'grid', 'blog', 'recent', 'news', 'amox']; |
| 53 |
} |
| 54 |
|
| 55 |
public function get_style_depends() |
| 56 |
{ |
| 57 |
if ($this->upk_is_edit_mode()) { |
| 58 |
return ['upk-all-styles']; |
| 59 |
} else { |
| 60 |
return ['upk-font', 'upk-amox-grid']; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
public function get_script_depends() |
| 65 |
{ |
| 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 |
{ |
| 75 |
return 'https://youtu.be/BeJ77OLErAk'; |
| 76 |
} |
| 77 |
|
| 78 |
public function get_query() |
| 79 |
{ |
| 80 |
return $this->_query; |
| 81 |
} |
| 82 |
|
| 83 |
public function has_widget_inner_wrapper(): bool { |
| 84 |
return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 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'), |
| 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-amox-grid' => 'grid-template-columns: repeat({{SIZE}}, 1fr);', |
| 113 |
], |
| 114 |
] |
| 115 |
); |
| 116 |
|
| 117 |
$this->add_responsive_control( |
| 118 |
'row_gap', |
| 119 |
[ |
| 120 |
'label' => esc_html__('Row Gap', 'ultimate-post-kit'), |
| 121 |
'type' => Controls_Manager::SLIDER, |
| 122 |
'selectors' => [ |
| 123 |
'{{WRAPPER}} .upk-amox-grid' => 'grid-row-gap: {{SIZE}}{{UNIT}};', |
| 124 |
], |
| 125 |
] |
| 126 |
); |
| 127 |
|
| 128 |
$this->add_responsive_control( |
| 129 |
'column_gap', |
| 130 |
[ |
| 131 |
'label' => esc_html__('Column Gap', 'ultimate-post-kit'), |
| 132 |
'type' => Controls_Manager::SLIDER, |
| 133 |
'selectors' => [ |
| 134 |
'{{WRAPPER}} .upk-amox-grid' => 'grid-column-gap: {{SIZE}}{{UNIT}};', |
| 135 |
], |
| 136 |
] |
| 137 |
); |
| 138 |
|
| 139 |
$this->add_responsive_control( |
| 140 |
'image_height', |
| 141 |
[ |
| 142 |
'label' => esc_html__('Image Height', 'ultimate-post-kit'), |
| 143 |
'type' => Controls_Manager::SLIDER, |
| 144 |
'range' => [ |
| 145 |
'px' => [ |
| 146 |
'min' => 100, |
| 147 |
'max' => 800, |
| 148 |
], |
| 149 |
], |
| 150 |
'selectors' => [ |
| 151 |
'{{WRAPPER}} .upk-amox-grid .upk-img-wrap' => 'height: {{SIZE}}px;', |
| 152 |
], |
| 153 |
] |
| 154 |
); |
| 155 |
|
| 156 |
$this->add_group_control( |
| 157 |
Group_Control_Image_Size::get_type(), |
| 158 |
[ |
| 159 |
'name' => 'primary_thumbnail', |
| 160 |
'exclude' => ['custom'], |
| 161 |
'default' => 'medium', |
| 162 |
] |
| 163 |
); |
| 164 |
|
| 165 |
$this->add_responsive_control( |
| 166 |
'content_alignment', |
| 167 |
[ |
| 168 |
'label' => __('Alignment', 'ultimate-post-kit'), |
| 169 |
'type' => Controls_Manager::CHOOSE, |
| 170 |
'options' => [ |
| 171 |
'left' => [ |
| 172 |
'title' => __('Left', 'ultimate-post-kit'), |
| 173 |
'icon' => 'eicon-text-align-left', |
| 174 |
], |
| 175 |
'center' => [ |
| 176 |
'title' => __('Center', 'ultimate-post-kit'), |
| 177 |
'icon' => 'eicon-text-align-center', |
| 178 |
], |
| 179 |
'right' => [ |
| 180 |
'title' => __('Right', 'ultimate-post-kit'), |
| 181 |
'icon' => 'eicon-text-align-right', |
| 182 |
], |
| 183 |
], |
| 184 |
'selectors' => [ |
| 185 |
'{{WRAPPER}} .upk-amox-grid .upk-item .upk-content' => 'text-align: {{VALUE}};', |
| 186 |
], |
| 187 |
] |
| 188 |
); |
| 189 |
|
| 190 |
$this->add_control( |
| 191 |
'active_item', |
| 192 |
[ |
| 193 |
'label' => __('Active Item', 'ultimate-post-kit') . BDTUPK_PC, |
| 194 |
'type' => Controls_Manager::NUMBER, |
| 195 |
'default' => 2, |
| 196 |
'description' => __('Be more creative with your design by typing in your item number.', 'ultimate-post-kit'), |
| 197 |
'separator' => 'before', |
| 198 |
'classes' => BDTUPK_IS_PC, |
| 199 |
] |
| 200 |
); |
| 201 |
|
| 202 |
$this->end_controls_section(); |
| 203 |
|
| 204 |
//New Query Builder Settings |
| 205 |
$this->start_controls_section( |
| 206 |
'section_post_query_builder', |
| 207 |
[ |
| 208 |
'label' => __('Query', 'ultimate-post-kit'), |
| 209 |
'tab' => Controls_Manager::TAB_CONTENT, |
| 210 |
] |
| 211 |
); |
| 212 |
|
| 213 |
$this->add_control( |
| 214 |
'item_limit', |
| 215 |
[ |
| 216 |
'label' => esc_html__('Item Limit', 'ultimate-post-kit'), |
| 217 |
'type' => Controls_Manager::SLIDER, |
| 218 |
'range' => [ |
| 219 |
'px' => [ |
| 220 |
'min' => 0, |
| 221 |
'max' => 21, |
| 222 |
], |
| 223 |
], |
| 224 |
'default' => [ |
| 225 |
'size' => 6, |
| 226 |
], |
| 227 |
'condition' => [ |
| 228 |
'posts_source!' => 'current_query', |
| 229 |
] |
| 230 |
] |
| 231 |
); |
| 232 |
|
| 233 |
$this->register_query_builder_controls(); |
| 234 |
|
| 235 |
$this->end_controls_section(); |
| 236 |
|
| 237 |
$this->start_controls_section( |
| 238 |
'section_content_additional', |
| 239 |
[ |
| 240 |
'label' => esc_html__('Additional Options', 'ultimate-post-kit'), |
| 241 |
] |
| 242 |
); |
| 243 |
|
| 244 |
//Global Title Controls |
| 245 |
$this->register_title_controls(); |
| 246 |
|
| 247 |
$this->add_control( |
| 248 |
'show_category', |
| 249 |
[ |
| 250 |
'label' => esc_html__('Category', 'ultimate-post-kit'), |
| 251 |
'type' => Controls_Manager::SWITCHER, |
| 252 |
'default' => 'yes', |
| 253 |
'separator' => 'before', |
| 254 |
] |
| 255 |
); |
| 256 |
|
| 257 |
//Global Date Controls |
| 258 |
$this->register_date_controls(); |
| 259 |
|
| 260 |
//Global Reading Time Controls |
| 261 |
$this->register_reading_time_controls(); |
| 262 |
|
| 263 |
$this->add_control( |
| 264 |
'meta_separator', |
| 265 |
[ |
| 266 |
'label' => esc_html__('Separator', 'ultimate-post-kit'), |
| 267 |
'type' => Controls_Manager::TEXT, |
| 268 |
'default' => '.', |
| 269 |
'label_block' => false, |
| 270 |
] |
| 271 |
); |
| 272 |
|
| 273 |
$this->add_control( |
| 274 |
'show_comments', |
| 275 |
[ |
| 276 |
'label' => esc_html__('Show Comments', 'ultimate-post-kit'), |
| 277 |
'type' => Controls_Manager::SWITCHER, |
| 278 |
'default' => 'yes', |
| 279 |
'separator' => 'before', |
| 280 |
] |
| 281 |
); |
| 282 |
|
| 283 |
$this->add_control( |
| 284 |
'show_pagination', |
| 285 |
[ |
| 286 |
'label' => esc_html__('Pagination', 'ultimate-post-kit'), |
| 287 |
'type' => Controls_Manager::SWITCHER, |
| 288 |
'separator' => 'before', |
| 289 |
] |
| 290 |
); |
| 291 |
|
| 292 |
//Global Ajax Controls |
| 293 |
$this->register_ajax_loadmore_controls(); |
| 294 |
|
| 295 |
$this->add_control( |
| 296 |
'global_link', |
| 297 |
[ |
| 298 |
'label' => esc_html__('Item Wrapper Link', 'ultimate-post-kit'), |
| 299 |
'type' => Controls_Manager::SWITCHER, |
| 300 |
'prefix_class' => 'upk-global-link-', |
| 301 |
'description' => esc_html__('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'), |
| 302 |
] |
| 303 |
); |
| 304 |
|
| 305 |
$this->end_controls_section(); |
| 306 |
|
| 307 |
//Style |
| 308 |
$this->start_controls_section( |
| 309 |
'upk_section_style', |
| 310 |
[ |
| 311 |
'label' => esc_html__('Items', 'ultimate-post-kit'), |
| 312 |
'tab' => Controls_Manager::TAB_STYLE, |
| 313 |
] |
| 314 |
); |
| 315 |
|
| 316 |
$this->add_responsive_control( |
| 317 |
'content_padding', |
| 318 |
[ |
| 319 |
'label' => esc_html__('Content Padding', 'ultimate-post-kit'), |
| 320 |
'type' => Controls_Manager::DIMENSIONS, |
| 321 |
'size_units' => ['px', 'em', '%'], |
| 322 |
'selectors' => [ |
| 323 |
'{{WRAPPER}} .upk-amox-grid .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 324 |
], |
| 325 |
] |
| 326 |
); |
| 327 |
|
| 328 |
$this->start_controls_tabs('tabs_item_style'); |
| 329 |
|
| 330 |
$this->start_controls_tab( |
| 331 |
'tab_item_normal', |
| 332 |
[ |
| 333 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 334 |
] |
| 335 |
); |
| 336 |
|
| 337 |
$this->add_group_control( |
| 338 |
Group_Control_Background::get_type(), |
| 339 |
[ |
| 340 |
'name' => 'content_background', |
| 341 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-item', |
| 342 |
] |
| 343 |
); |
| 344 |
|
| 345 |
$this->add_group_control( |
| 346 |
Group_Control_Border::get_type(), |
| 347 |
[ |
| 348 |
'name' => 'item_border', |
| 349 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-item', |
| 350 |
] |
| 351 |
); |
| 352 |
|
| 353 |
$this->add_responsive_control( |
| 354 |
'item_border_radius', |
| 355 |
[ |
| 356 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 357 |
'type' => Controls_Manager::DIMENSIONS, |
| 358 |
'size_units' => ['px', '%'], |
| 359 |
'selectors' => [ |
| 360 |
'{{WRAPPER}} .upk-amox-grid .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 361 |
], |
| 362 |
] |
| 363 |
); |
| 364 |
|
| 365 |
$this->add_responsive_control( |
| 366 |
'item_padding', |
| 367 |
[ |
| 368 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 369 |
'type' => Controls_Manager::DIMENSIONS, |
| 370 |
'size_units' => ['px', 'em', '%'], |
| 371 |
'selectors' => [ |
| 372 |
'{{WRAPPER}} .upk-amox-grid .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 373 |
], |
| 374 |
] |
| 375 |
); |
| 376 |
|
| 377 |
$this->add_group_control( |
| 378 |
Group_Control_Box_Shadow::get_type(), |
| 379 |
[ |
| 380 |
'name' => 'item_box_shadow', |
| 381 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-item', |
| 382 |
] |
| 383 |
); |
| 384 |
|
| 385 |
$this->end_controls_tab(); |
| 386 |
|
| 387 |
$this->start_controls_tab( |
| 388 |
'tab_item_hover', |
| 389 |
[ |
| 390 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 391 |
] |
| 392 |
); |
| 393 |
|
| 394 |
$this->add_group_control( |
| 395 |
Group_Control_Background::get_type(), |
| 396 |
[ |
| 397 |
'name' => 'content_hover_background', |
| 398 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-item:hover', |
| 399 |
] |
| 400 |
); |
| 401 |
|
| 402 |
$this->add_control( |
| 403 |
'item_hover_border_color', |
| 404 |
[ |
| 405 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 406 |
'type' => Controls_Manager::COLOR, |
| 407 |
'condition' => [ |
| 408 |
'item_border_border!' => '', |
| 409 |
], |
| 410 |
'selectors' => [ |
| 411 |
'{{WRAPPER}} .upk-amox-grid .upk-item:hover' => 'border-color: {{VALUE}};', |
| 412 |
], |
| 413 |
] |
| 414 |
); |
| 415 |
|
| 416 |
$this->add_group_control( |
| 417 |
Group_Control_Box_Shadow::get_type(), |
| 418 |
[ |
| 419 |
'name' => 'item_hover_box_shadow', |
| 420 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-item:hover', |
| 421 |
] |
| 422 |
); |
| 423 |
|
| 424 |
$this->end_controls_tab(); |
| 425 |
|
| 426 |
$this->end_controls_tabs(); |
| 427 |
|
| 428 |
$this->end_controls_section(); |
| 429 |
|
| 430 |
$this->start_controls_section( |
| 431 |
'section_style_title', |
| 432 |
[ |
| 433 |
'label' => esc_html__('Title', 'ultimate-post-kit'), |
| 434 |
'tab' => Controls_Manager::TAB_STYLE, |
| 435 |
'condition' => [ |
| 436 |
'show_title' => 'yes', |
| 437 |
], |
| 438 |
] |
| 439 |
); |
| 440 |
|
| 441 |
$this->add_control( |
| 442 |
'title_style', |
| 443 |
[ |
| 444 |
'label' => esc_html__('Style', 'ultimate-post-kit'), |
| 445 |
'type' => Controls_Manager::SELECT, |
| 446 |
'default' => 'underline', |
| 447 |
'options' => [ |
| 448 |
'' => esc_html__('Default', 'ultimate-post-kit'), |
| 449 |
'underline' => esc_html__('Underline', 'ultimate-post-kit'), |
| 450 |
'middle-underline' => esc_html__('Middle Underline', 'ultimate-post-kit'), |
| 451 |
'overline' => esc_html__('Overline', 'ultimate-post-kit'), |
| 452 |
'middle-overline' => esc_html__('Middle Overline', 'ultimate-post-kit'), |
| 453 |
], |
| 454 |
] |
| 455 |
); |
| 456 |
|
| 457 |
$this->add_responsive_control( |
| 458 |
'title_spacing', |
| 459 |
[ |
| 460 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 461 |
'type' => Controls_Manager::SLIDER, |
| 462 |
'range' => [ |
| 463 |
'px' => [ |
| 464 |
'min' => 0, |
| 465 |
'max' => 50, |
| 466 |
], |
| 467 |
], |
| 468 |
'selectors' => [ |
| 469 |
'{{WRAPPER}} .upk-amox-grid .upk-title' => 'padding-bottom: {{SIZE}}{{UNIT}};', |
| 470 |
], |
| 471 |
] |
| 472 |
); |
| 473 |
|
| 474 |
$this->add_group_control( |
| 475 |
Group_Control_Typography::get_type(), |
| 476 |
[ |
| 477 |
'name' => 'title_typography', |
| 478 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 479 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-title', |
| 480 |
] |
| 481 |
); |
| 482 |
|
| 483 |
$this->add_group_control( |
| 484 |
Group_Control_Text_Shadow::get_type(), |
| 485 |
[ |
| 486 |
'name' => 'title_text_shadow', |
| 487 |
'label' => __('Text Shadow', 'ultimate-post-kit'), |
| 488 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-title', |
| 489 |
] |
| 490 |
); |
| 491 |
|
| 492 |
$this->start_controls_tabs('tabs_title_style'); |
| 493 |
|
| 494 |
$this->start_controls_tab( |
| 495 |
'tab_title_normal', |
| 496 |
[ |
| 497 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 498 |
] |
| 499 |
); |
| 500 |
|
| 501 |
$this->add_control( |
| 502 |
'title_color', |
| 503 |
[ |
| 504 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 505 |
'type' => Controls_Manager::COLOR, |
| 506 |
'selectors' => [ |
| 507 |
'{{WRAPPER}} .upk-amox-grid .upk-title a' => 'color: {{VALUE}};', |
| 508 |
], |
| 509 |
] |
| 510 |
); |
| 511 |
|
| 512 |
$this->end_controls_tab(); |
| 513 |
|
| 514 |
$this->start_controls_tab( |
| 515 |
'tab_title_hover', |
| 516 |
[ |
| 517 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 518 |
] |
| 519 |
); |
| 520 |
|
| 521 |
$this->add_control( |
| 522 |
'title_color_hover', |
| 523 |
[ |
| 524 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 525 |
'type' => Controls_Manager::COLOR, |
| 526 |
'selectors' => [ |
| 527 |
'{{WRAPPER}} .upk-amox-grid .upk-title a:hover' => 'color: {{VALUE}};', |
| 528 |
], |
| 529 |
] |
| 530 |
); |
| 531 |
|
| 532 |
$this->end_controls_tab(); |
| 533 |
|
| 534 |
$this->end_controls_tabs(); |
| 535 |
|
| 536 |
$this->end_controls_section(); |
| 537 |
|
| 538 |
$this->start_controls_section( |
| 539 |
'section_style_meta', |
| 540 |
[ |
| 541 |
'label' => esc_html__('Meta', 'ultimate-post-kit'), |
| 542 |
'tab' => Controls_Manager::TAB_STYLE, |
| 543 |
'conditions' => [ |
| 544 |
'relation' => 'or', |
| 545 |
'terms' => [ |
| 546 |
[ |
| 547 |
'name' => 'show_date', |
| 548 |
'value' => 'yes', |
| 549 |
], |
| 550 |
[ |
| 551 |
'name' => 'show_comments', |
| 552 |
'value' => 'yes', |
| 553 |
], |
| 554 |
], |
| 555 |
], |
| 556 |
] |
| 557 |
); |
| 558 |
|
| 559 |
$this->add_control( |
| 560 |
'meta_color', |
| 561 |
[ |
| 562 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 563 |
'type' => Controls_Manager::COLOR, |
| 564 |
'selectors' => [ |
| 565 |
'{{WRAPPER}} .upk-amox-grid .upk-meta' => 'color: {{VALUE}};', |
| 566 |
], |
| 567 |
] |
| 568 |
); |
| 569 |
|
| 570 |
$this->add_responsive_control( |
| 571 |
'meta_space_between', |
| 572 |
[ |
| 573 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 574 |
'type' => Controls_Manager::SLIDER, |
| 575 |
'range' => [ |
| 576 |
'px' => [ |
| 577 |
'min' => 0, |
| 578 |
'max' => 50, |
| 579 |
], |
| 580 |
], |
| 581 |
'selectors' => [ |
| 582 |
'{{WRAPPER}} .upk-amox-grid .upk-meta > div:before' => 'margin: 0 {{SIZE}}{{UNIT}};', |
| 583 |
], |
| 584 |
] |
| 585 |
); |
| 586 |
|
| 587 |
$this->add_group_control( |
| 588 |
Group_Control_Typography::get_type(), |
| 589 |
[ |
| 590 |
'name' => 'meta_typography', |
| 591 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 592 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-meta', |
| 593 |
] |
| 594 |
); |
| 595 |
|
| 596 |
$this->end_controls_section(); |
| 597 |
|
| 598 |
$this->start_controls_section( |
| 599 |
'section_style_category', |
| 600 |
[ |
| 601 |
'label' => esc_html__('Category', 'ultimate-post-kit'), |
| 602 |
'tab' => Controls_Manager::TAB_STYLE, |
| 603 |
'condition' => [ |
| 604 |
'show_category' => 'yes', |
| 605 |
], |
| 606 |
] |
| 607 |
); |
| 608 |
|
| 609 |
$this->add_responsive_control( |
| 610 |
'category_bottom_spacing', |
| 611 |
[ |
| 612 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 613 |
'type' => Controls_Manager::SLIDER, |
| 614 |
'range' => [ |
| 615 |
'px' => [ |
| 616 |
'min' => 0, |
| 617 |
'max' => 50, |
| 618 |
], |
| 619 |
], |
| 620 |
'selectors' => [ |
| 621 |
'{{WRAPPER}} .upk-amox-grid .upk-category' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 622 |
], |
| 623 |
] |
| 624 |
); |
| 625 |
|
| 626 |
$this->start_controls_tabs('tabs_category_style'); |
| 627 |
|
| 628 |
$this->start_controls_tab( |
| 629 |
'tab_category_normal', |
| 630 |
[ |
| 631 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 632 |
] |
| 633 |
); |
| 634 |
|
| 635 |
$this->add_control( |
| 636 |
'category_color', |
| 637 |
[ |
| 638 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 639 |
'type' => Controls_Manager::COLOR, |
| 640 |
'selectors' => [ |
| 641 |
'{{WRAPPER}} .upk-amox-grid .upk-category a' => 'color: {{VALUE}};', |
| 642 |
], |
| 643 |
] |
| 644 |
); |
| 645 |
|
| 646 |
$this->add_group_control( |
| 647 |
Group_Control_Background::get_type(), |
| 648 |
[ |
| 649 |
'name' => 'category_background', |
| 650 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-category a', |
| 651 |
] |
| 652 |
); |
| 653 |
|
| 654 |
$this->add_group_control( |
| 655 |
Group_Control_Border::get_type(), |
| 656 |
[ |
| 657 |
'name' => 'category_border', |
| 658 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-category a', |
| 659 |
] |
| 660 |
); |
| 661 |
|
| 662 |
$this->add_responsive_control( |
| 663 |
'category_border_radius', |
| 664 |
[ |
| 665 |
'label' => esc_html__('Border Radius', 'ultimate-post-kit'), |
| 666 |
'type' => Controls_Manager::DIMENSIONS, |
| 667 |
'size_units' => ['px', '%'], |
| 668 |
'selectors' => [ |
| 669 |
'{{WRAPPER}} .upk-amox-grid .upk-category a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 670 |
], |
| 671 |
] |
| 672 |
); |
| 673 |
|
| 674 |
$this->add_responsive_control( |
| 675 |
'category_padding', |
| 676 |
[ |
| 677 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 678 |
'type' => Controls_Manager::DIMENSIONS, |
| 679 |
'size_units' => ['px', 'em', '%'], |
| 680 |
'selectors' => [ |
| 681 |
'{{WRAPPER}} .upk-amox-grid .upk-category a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 682 |
], |
| 683 |
] |
| 684 |
); |
| 685 |
|
| 686 |
$this->add_responsive_control( |
| 687 |
'category_spacing', |
| 688 |
[ |
| 689 |
'label' => esc_html__('Space Between', 'ultimate-post-kit'), |
| 690 |
'type' => Controls_Manager::SLIDER, |
| 691 |
'range' => [ |
| 692 |
'px' => [ |
| 693 |
'min' => 0, |
| 694 |
'max' => 50, |
| 695 |
'step' => 2, |
| 696 |
], |
| 697 |
], |
| 698 |
'selectors' => [ |
| 699 |
'{{WRAPPER}} .upk-amox-grid .upk-category' => 'gap: {{SIZE}}{{UNIT}};', |
| 700 |
], |
| 701 |
] |
| 702 |
); |
| 703 |
|
| 704 |
$this->add_group_control( |
| 705 |
Group_Control_Box_Shadow::get_type(), |
| 706 |
[ |
| 707 |
'name' => 'category_shadow', |
| 708 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-category a', |
| 709 |
] |
| 710 |
); |
| 711 |
|
| 712 |
$this->add_group_control( |
| 713 |
Group_Control_Typography::get_type(), |
| 714 |
[ |
| 715 |
'name' => 'category_typography', |
| 716 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 717 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-category a', |
| 718 |
] |
| 719 |
); |
| 720 |
|
| 721 |
$this->end_controls_tab(); |
| 722 |
|
| 723 |
$this->start_controls_tab( |
| 724 |
'tab_category_hover', |
| 725 |
[ |
| 726 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 727 |
] |
| 728 |
); |
| 729 |
|
| 730 |
$this->add_control( |
| 731 |
'category_hover_color', |
| 732 |
[ |
| 733 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 734 |
'type' => Controls_Manager::COLOR, |
| 735 |
'selectors' => [ |
| 736 |
'{{WRAPPER}} .upk-amox-grid .upk-category a:hover' => 'color: {{VALUE}};', |
| 737 |
], |
| 738 |
] |
| 739 |
); |
| 740 |
|
| 741 |
$this->add_group_control( |
| 742 |
Group_Control_Background::get_type(), |
| 743 |
[ |
| 744 |
'name' => 'category_hover_background', |
| 745 |
'selector' => '{{WRAPPER}} .upk-amox-grid .upk-category a:hover', |
| 746 |
] |
| 747 |
); |
| 748 |
|
| 749 |
$this->add_control( |
| 750 |
'category_hover_border_color', |
| 751 |
[ |
| 752 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 753 |
'type' => Controls_Manager::COLOR, |
| 754 |
'condition' => [ |
| 755 |
'category_border_border!' => '', |
| 756 |
], |
| 757 |
'selectors' => [ |
| 758 |
'{{WRAPPER}} .upk-amox-grid .upk-category a:hover' => 'border-color: {{VALUE}};', |
| 759 |
], |
| 760 |
] |
| 761 |
); |
| 762 |
|
| 763 |
$this->end_controls_tab(); |
| 764 |
|
| 765 |
if (_is_upk_pro_activated()) { |
| 766 |
$this->start_controls_tab( |
| 767 |
'tab_category_active', |
| 768 |
[ |
| 769 |
'label' => esc_html__('Active', 'ultimate-post-kit'), |
| 770 |
] |
| 771 |
); |
| 772 |
|
| 773 |
$this->add_control( |
| 774 |
'category_active_normal_heading', |
| 775 |
[ |
| 776 |
'label' => esc_html__('NORMAL', 'ultimate-post-kit'), |
| 777 |
'type' => Controls_Manager::HEADING, |
| 778 |
] |
| 779 |
); |
| 780 |
|
| 781 |
$this->end_controls_tab(); |
| 782 |
} |
| 783 |
|
| 784 |
$this->end_controls_tabs(); |
| 785 |
|
| 786 |
$this->end_controls_section(); |
| 787 |
|
| 788 |
//Pagination |
| 789 |
$this->start_controls_section( |
| 790 |
'section_style_pagination', |
| 791 |
[ |
| 792 |
'label' => esc_html__('Pagination', 'ultimate-post-kit'), |
| 793 |
'tab' => Controls_Manager::TAB_STYLE, |
| 794 |
'condition' => [ |
| 795 |
'show_pagination' => 'yes', |
| 796 |
], |
| 797 |
] |
| 798 |
); |
| 799 |
|
| 800 |
$this->start_controls_tabs('tabs_pagination_style'); |
| 801 |
|
| 802 |
$this->start_controls_tab( |
| 803 |
'tab_pagination_normal', |
| 804 |
[ |
| 805 |
'label' => esc_html__('Normal', 'ultimate-post-kit'), |
| 806 |
] |
| 807 |
); |
| 808 |
|
| 809 |
$this->add_control( |
| 810 |
'pagination_color', |
| 811 |
[ |
| 812 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 813 |
'type' => Controls_Manager::COLOR, |
| 814 |
'selectors' => [ |
| 815 |
'{{WRAPPER}} ul.upk-pagination li a, {{WRAPPER}} ul.upk-pagination li span' => 'color: {{VALUE}};', |
| 816 |
], |
| 817 |
] |
| 818 |
); |
| 819 |
|
| 820 |
$this->add_group_control( |
| 821 |
Group_Control_Background::get_type(), |
| 822 |
[ |
| 823 |
'name' => 'pagination_background', |
| 824 |
'types' => ['classic', 'gradient'], |
| 825 |
'selector' => '{{WRAPPER}} ul.upk-pagination li a', |
| 826 |
'separator' => 'after', |
| 827 |
] |
| 828 |
); |
| 829 |
|
| 830 |
$this->add_group_control( |
| 831 |
Group_Control_Border::get_type(), |
| 832 |
[ |
| 833 |
'name' => 'pagination_border', |
| 834 |
'label' => esc_html__('Border', 'ultimate-post-kit'), |
| 835 |
'selector' => '{{WRAPPER}} ul.upk-pagination li a', |
| 836 |
] |
| 837 |
); |
| 838 |
|
| 839 |
$this->add_responsive_control( |
| 840 |
'pagination_offset', |
| 841 |
[ |
| 842 |
'label' => esc_html__('Offset', 'ultimate-post-kit'), |
| 843 |
'type' => Controls_Manager::SLIDER, |
| 844 |
'selectors' => [ |
| 845 |
'{{WRAPPER}} .upk-pagination' => 'margin-top: {{SIZE}}px;', |
| 846 |
], |
| 847 |
] |
| 848 |
); |
| 849 |
|
| 850 |
$this->add_responsive_control( |
| 851 |
'pagination_space', |
| 852 |
[ |
| 853 |
'label' => esc_html__('Spacing', 'ultimate-post-kit'), |
| 854 |
'type' => Controls_Manager::SLIDER, |
| 855 |
'selectors' => [ |
| 856 |
'{{WRAPPER}} .upk-pagination' => 'margin-left: {{SIZE}}px;', |
| 857 |
'{{WRAPPER}} .upk-pagination > *' => 'padding-left: {{SIZE}}px;', |
| 858 |
], |
| 859 |
] |
| 860 |
); |
| 861 |
|
| 862 |
$this->add_responsive_control( |
| 863 |
'pagination_padding', |
| 864 |
[ |
| 865 |
'label' => esc_html__('Padding', 'ultimate-post-kit'), |
| 866 |
'type' => Controls_Manager::DIMENSIONS, |
| 867 |
'selectors' => [ |
| 868 |
'{{WRAPPER}} ul.upk-pagination li a' => 'padding: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 869 |
], |
| 870 |
] |
| 871 |
); |
| 872 |
|
| 873 |
$this->add_responsive_control( |
| 874 |
'pagination_radius', |
| 875 |
[ |
| 876 |
'label' => esc_html__('Radius', 'ultimate-post-kit'), |
| 877 |
'type' => Controls_Manager::DIMENSIONS, |
| 878 |
'selectors' => [ |
| 879 |
'{{WRAPPER}} ul.upk-pagination li a' => 'border-radius: {{TOP}}px {{RIGHT}}px {{BOTTOM}}px {{LEFT}}px;', |
| 880 |
], |
| 881 |
] |
| 882 |
); |
| 883 |
|
| 884 |
$this->add_responsive_control( |
| 885 |
'pagination_arrow_size', |
| 886 |
[ |
| 887 |
'label' => esc_html__('Arrow Size', 'ultimate-post-kit'), |
| 888 |
'type' => Controls_Manager::SLIDER, |
| 889 |
'selectors' => [ |
| 890 |
'{{WRAPPER}} ul.upk-pagination li a svg' => 'height: {{SIZE}}px; width: auto;', |
| 891 |
], |
| 892 |
] |
| 893 |
); |
| 894 |
|
| 895 |
$this->add_group_control( |
| 896 |
Group_Control_Typography::get_type(), |
| 897 |
[ |
| 898 |
'name' => 'pagination_typography', |
| 899 |
'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 900 |
//'scheme' => Schemes\Typography::TYPOGRAPHY_4, |
| 901 |
'selector' => '{{WRAPPER}} ul.upk-pagination li a, {{WRAPPER}} ul.upk-pagination li span', |
| 902 |
] |
| 903 |
); |
| 904 |
|
| 905 |
$this->end_controls_tab(); |
| 906 |
|
| 907 |
$this->start_controls_tab( |
| 908 |
'tab_pagination_hover', |
| 909 |
[ |
| 910 |
'label' => esc_html__('Hover', 'ultimate-post-kit'), |
| 911 |
] |
| 912 |
); |
| 913 |
|
| 914 |
$this->add_control( |
| 915 |
'pagination_hover_color', |
| 916 |
[ |
| 917 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 918 |
'type' => Controls_Manager::COLOR, |
| 919 |
'selectors' => [ |
| 920 |
'{{WRAPPER}} ul.upk-pagination li a:hover' => 'color: {{VALUE}};', |
| 921 |
], |
| 922 |
] |
| 923 |
); |
| 924 |
|
| 925 |
$this->add_control( |
| 926 |
'pagination_hover_border_color', |
| 927 |
[ |
| 928 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 929 |
'type' => Controls_Manager::COLOR, |
| 930 |
'selectors' => [ |
| 931 |
'{{WRAPPER}} ul.upk-pagination li a:hover' => 'border-color: {{VALUE}};', |
| 932 |
], |
| 933 |
] |
| 934 |
); |
| 935 |
|
| 936 |
$this->add_group_control( |
| 937 |
Group_Control_Background::get_type(), |
| 938 |
[ |
| 939 |
'name' => 'pagination_hover_background', |
| 940 |
'types' => ['classic', 'gradient'], |
| 941 |
'selector' => '{{WRAPPER}} ul.upk-pagination li a:hover', |
| 942 |
] |
| 943 |
); |
| 944 |
|
| 945 |
$this->end_controls_tab(); |
| 946 |
|
| 947 |
$this->start_controls_tab( |
| 948 |
'tab_pagination_active', |
| 949 |
[ |
| 950 |
'label' => esc_html__('Active', 'ultimate-post-kit'), |
| 951 |
] |
| 952 |
); |
| 953 |
|
| 954 |
$this->add_control( |
| 955 |
'pagination_active_color', |
| 956 |
[ |
| 957 |
'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 958 |
'type' => Controls_Manager::COLOR, |
| 959 |
'selectors' => [ |
| 960 |
'{{WRAPPER}} ul.upk-pagination li.upk-active a' => 'color: {{VALUE}};', |
| 961 |
], |
| 962 |
] |
| 963 |
); |
| 964 |
|
| 965 |
$this->add_control( |
| 966 |
'pagination_active_border_color', |
| 967 |
[ |
| 968 |
'label' => esc_html__('Border Color', 'ultimate-post-kit'), |
| 969 |
'type' => Controls_Manager::COLOR, |
| 970 |
'selectors' => [ |
| 971 |
'{{WRAPPER}} ul.upk-pagination li.upk-active a' => 'border-color: {{VALUE}};', |
| 972 |
], |
| 973 |
] |
| 974 |
); |
| 975 |
|
| 976 |
$this->add_group_control( |
| 977 |
Group_Control_Background::get_type(), |
| 978 |
[ |
| 979 |
'name' => 'pagination_active_background', |
| 980 |
'selector' => '{{WRAPPER}} ul.upk-pagination li.upk-active a', |
| 981 |
] |
| 982 |
); |
| 983 |
|
| 984 |
$this->end_controls_tab(); |
| 985 |
|
| 986 |
$this->end_controls_tabs(); |
| 987 |
|
| 988 |
$this->end_controls_section(); |
| 989 |
|
| 990 |
//Global Ajax Loadmore Style Controls |
| 991 |
$this->register_ajax_loadmore_style_controls(); |
| 992 |
} |
| 993 |
|
| 994 |
/** |
| 995 |
* Get post query builder arguments |
| 996 |
*/ |
| 997 |
public function query_posts( $posts_per_page ) { |
| 998 |
$settings = $this->get_settings(); |
| 999 |
$posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0; |
| 1000 |
$args = $this->getGroupControlQueryArgs(); |
| 1001 |
$is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' ); |
| 1002 |
|
| 1003 |
if ( $is_current_query ) { |
| 1004 |
unset( $args['offset'] ); |
| 1005 |
unset( $args['no_found_rows'] ); |
| 1006 |
$posts_per_page = 0; |
| 1007 |
} |
| 1008 |
|
| 1009 |
if ( $posts_per_page > 0 ) { |
| 1010 |
$args['posts_per_page'] = $posts_per_page; |
| 1011 |
} else { |
| 1012 |
$args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 ); |
| 1013 |
} |
| 1014 |
|
| 1015 |
if ( $settings['show_pagination'] ) { |
| 1016 |
$args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) ); |
| 1017 |
} |
| 1018 |
|
| 1019 |
$this->_query = new \WP_Query( $args ); |
| 1020 |
} |
| 1021 |
|
| 1022 |
public function render_comments($id = 0) |
| 1023 |
{ |
| 1024 |
|
| 1025 |
if (!$this->get_settings('show_comments')) { |
| 1026 |
return; |
| 1027 |
} |
| 1028 |
?> |
| 1029 |
|
| 1030 |
<div class="upk-comments upk-flex upk-flex-middle"> |
| 1031 |
<i class="upk-icon-post-comments" aria-hidden="true"></i> |
| 1032 |
<span><?php echo esc_html( $this->upk_get_localized_comment_count( $id ) ); ?></span> |
| 1033 |
</div> |
| 1034 |
|
| 1035 |
<?php |
| 1036 |
} |
| 1037 |
|
| 1038 |
public function render_post_grid_item($post_id, $image_size, $active_item) |
| 1039 |
{ |
| 1040 |
$settings = $this->get_settings_for_display(); |
| 1041 |
|
| 1042 |
if ('yes' == $settings['global_link']) { |
| 1043 |
|
| 1044 |
$this->add_render_attribute('grid-item', 'onclick', "window.open('" . esc_url(get_permalink()) . "', '_self')", true); |
| 1045 |
} |
| 1046 |
|
| 1047 |
$this->add_render_attribute('grid-item', 'class', 'upk-item ' . $active_item, true); |
| 1048 |
|
| 1049 |
?> |
| 1050 |
<div <?php $this->print_render_attribute_string('grid-item');?>> |
| 1051 |
<div class="upk-img-wrap"> |
| 1052 |
<?php $this->render_image(get_post_thumbnail_id($post_id), $image_size);?> |
| 1053 |
</div> |
| 1054 |
<div class="upk-content"> |
| 1055 |
<?php $this->render_category();?> |
| 1056 |
<?php $this->render_title(substr($this->get_name(), 4));?> |
| 1057 |
|
| 1058 |
<?php if ($settings['show_comments'] or $settings['show_date'] or $settings['show_reading_time']): ?> |
| 1059 |
<div class="upk-meta upk-flex-inline upk-flex-middle"> |
| 1060 |
<?php $this->render_date();?> |
| 1061 |
<?php if (_is_upk_pro_activated()): |
| 1062 |
if ('yes' === $settings['show_reading_time']): ?> |
| 1063 |
<div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1064 |
<?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) );?> |
| 1065 |
</div> |
| 1066 |
<?php endif;?> |
| 1067 |
<?php endif;?> |
| 1068 |
<div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> |
| 1069 |
<?php $this->render_comments($post_id);?> |
| 1070 |
</div> |
| 1071 |
</div> |
| 1072 |
<?php endif;?> |
| 1073 |
</div> |
| 1074 |
</div> |
| 1075 |
|
| 1076 |
|
| 1077 |
<?php |
| 1078 |
} |
| 1079 |
|
| 1080 |
protected function render() |
| 1081 |
{ |
| 1082 |
$settings = $this->get_settings_for_display(); |
| 1083 |
|
| 1084 |
$this->query_posts($settings['item_limit']['size']); |
| 1085 |
$wp_query = $this->get_query(); |
| 1086 |
|
| 1087 |
if (!$wp_query->found_posts) { |
| 1088 |
return; |
| 1089 |
} |
| 1090 |
|
| 1091 |
$this->add_render_attribute('grid-wrap', 'class', 'upk-amox-grid upk-ajax-grid-wrap'); |
| 1092 |
$this->add_render_attribute( |
| 1093 |
[ |
| 1094 |
'upk-amox-grid-container' => [ |
| 1095 |
'class' => 'upk-amox-grid-container upk-ajax-grid', |
| 1096 |
'data-loadmore' => [ |
| 1097 |
wp_json_encode( |
| 1098 |
array_filter([ |
| 1099 |
'loadmore_enable' => $settings['ajax_loadmore_enable'], |
| 1100 |
'loadmore_btn' => $settings['ajax_loadmore_btn'], |
| 1101 |
'infinite_scroll' => $settings['ajax_loadmore_infinite_scroll'], |
| 1102 |
]) |
| 1103 |
), |
| 1104 |
], |
| 1105 |
], |
| 1106 |
] |
| 1107 |
); |
| 1108 |
|
| 1109 |
if ( $settings['ajax_loadmore_enable'] == 'yes' ) { |
| 1110 |
$ajax_settings = [ |
| 1111 |
'posts_source' => isset( $settings['posts_source'] ) ? $settings['posts_source'] : 'post', |
| 1112 |
'posts_per_page' => isset( $posts_load ) ? $posts_load : 6, |
| 1113 |
'ajax_item_load' => isset( $settings['ajax_loadmore_items'] ) ? $settings['ajax_loadmore_items'] : 3, |
| 1114 |
'posts_selected_ids' => isset( $settings['posts_selected_ids'] ) ? $settings['posts_selected_ids'] : '', |
| 1115 |
'posts_include_by' => isset( $settings['posts_include_by'] ) ? $settings['posts_include_by'] : [], |
| 1116 |
'posts_include_author_ids' => isset( $settings['posts_include_author_ids'] ) ? $settings['posts_include_author_ids'] : '', |
| 1117 |
'posts_include_term_ids' => isset( $settings['posts_include_term_ids'] ) ? $settings['posts_include_term_ids'] : '', |
| 1118 |
'posts_exclude_by' => isset( $settings['posts_exclude_by'] ) ? $settings['posts_exclude_by'] : [], |
| 1119 |
'posts_exclude_ids' => isset( $settings['posts_exclude_ids'] ) ? $settings['posts_exclude_ids'] : '', |
| 1120 |
'posts_exclude_author_ids' => isset( $settings['posts_exclude_author_ids'] ) ? $settings['posts_exclude_author_ids'] : '', |
| 1121 |
'posts_exclude_term_ids' => isset( $settings['posts_exclude_term_ids'] ) ? $settings['posts_exclude_term_ids'] : '', |
| 1122 |
'posts_offset' => isset( $settings['posts_offset'] ) ? $settings['posts_offset'] : 0, |
| 1123 |
'posts_select_date' => isset( $settings['posts_select_date'] ) ? $settings['posts_select_date'] : '', |
| 1124 |
'posts_date_before' => isset( $settings['posts_date_before'] ) ? $settings['posts_date_before'] : '', |
| 1125 |
'posts_date_after' => isset( $settings['posts_date_after'] ) ? $settings['posts_date_after'] : '', |
| 1126 |
'posts_orderby' => isset( $settings['posts_orderby'] ) ? $settings['posts_orderby'] : 'date', |
| 1127 |
'posts_order' => isset( $settings['posts_order'] ) ? $settings['posts_order'] : 'DESC', |
| 1128 |
'posts_ignore_sticky_posts' => isset( $settings['posts_ignore_sticky_posts'] ) ? $settings['posts_ignore_sticky_posts'] : 'no', |
| 1129 |
'posts_only_with_featured_image' => isset( $settings['posts_only_with_featured_image'] ) ? $settings['posts_only_with_featured_image'] : 'no', |
| 1130 |
// Grid Settings |
| 1131 |
'show_title' => isset( $settings['show_title'] ) ? $settings['show_title'] : 'yes', |
| 1132 |
'title_tags' => isset( $settings['title_tags'] ) ? $settings['title_tags'] : 'h3', |
| 1133 |
'show_date' => isset( $settings['show_date'] ) ? $settings['show_date'] : 'yes', |
| 1134 |
'show_time' => isset( $settings['show_time'] ) ? $settings['show_time'] : 'no', |
| 1135 |
'show_category' => isset( $settings['show_category'] ) ? $settings['show_category'] : 'yes', |
| 1136 |
'show_comments' => isset( $settings['show_comments'] ) ? $settings['show_comments'] : 'yes', |
| 1137 |
'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no', |
| 1138 |
'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200, |
| 1139 |
'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no', |
| 1140 |
'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no', |
| 1141 |
'upk_link_new_tab' => isset( $settings['upk_link_new_tab'] ) ? $settings['upk_link_new_tab'] : 'no', |
| 1142 |
'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '.', |
| 1143 |
'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no', |
| 1144 |
'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no', |
| 1145 |
'title_style' => isset( $settings['title_style'] ) ? $settings['title_style'] : 'underline', |
| 1146 |
'global_link' => isset( $settings['global_link'] ) ? $settings['global_link'] : 'no', |
| 1147 |
]; |
| 1148 |
|
| 1149 |
$this->add_render_attribute( |
| 1150 |
[ |
| 1151 |
'upk-amox-grid-container' => [ |
| 1152 |
'data-settings' => [ |
| 1153 |
wp_json_encode( $ajax_settings ), |
| 1154 |
], |
| 1155 |
], |
| 1156 |
] |
| 1157 |
); |
| 1158 |
} |
| 1159 |
|
| 1160 |
if (isset($settings['upk_in_animation_show']) && ($settings['upk_in_animation_show'] == 'yes')) { |
| 1161 |
$this->add_render_attribute('grid-wrap', 'class', 'upk-in-animation'); |
| 1162 |
if (isset($settings['upk_in_animation_delay']['size'])) { |
| 1163 |
$this->add_render_attribute('grid-wrap', 'data-in-animation-delay', $settings['upk_in_animation_delay']['size']); |
| 1164 |
} |
| 1165 |
} |
| 1166 |
|
| 1167 |
?> |
| 1168 |
<div <?php $this->print_render_attribute_string('upk-amox-grid-container');?>> |
| 1169 |
<div <?php $this->print_render_attribute_string('grid-wrap');?>> |
| 1170 |
<?php |
| 1171 |
$i = 0; |
| 1172 |
while ($wp_query->have_posts()): |
| 1173 |
$wp_query->the_post(); |
| 1174 |
$thumbnail_size = $settings['primary_thumbnail_size']; |
| 1175 |
|
| 1176 |
$i++; |
| 1177 |
$active_item = ''; |
| 1178 |
if (_is_upk_pro_activated()) { |
| 1179 |
$active_item = apply_filters('amox_grid_active_item', $this, $i); |
| 1180 |
} |
| 1181 |
|
| 1182 |
?> |
| 1183 |
<?php $this->render_post_grid_item(get_the_ID(), $thumbnail_size, $active_item);?> |
| 1184 |
<?php endwhile;?> |
| 1185 |
</div> |
| 1186 |
</div> |
| 1187 |
|
| 1188 |
<?php $this->render_ajax_loadmore(); ?> |
| 1189 |
|
| 1190 |
<?php |
| 1191 |
|
| 1192 |
if ($settings['show_pagination']) {?> |
| 1193 |
<div class="ep-pagination"> |
| 1194 |
<?php ultimate_post_kit_post_pagination($wp_query, $this->get_id());?> |
| 1195 |
</div> |
| 1196 |
<?php |
| 1197 |
} |
| 1198 |
wp_reset_postdata(); |
| 1199 |
} |
| 1200 |
} |
| 1201 |
|