| @@ -103,8 +103,9 @@ | ||
| 103 | 103 | // } else { |
| 104 | 104 | // $column_size = ''; |
| 105 | 105 | // } |
| 106 | 106 | |
| 107 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration. | |
| 107 | 108 | $column_size = apply_filters('upk_column_size', ''); |
| 108 | 109 | |
| 109 | 110 | $this->add_responsive_control( |
| 110 | 111 | 'columns', |
| @@ -191,8 +192,12 @@ | ||
| 191 | 192 | 'min' => 200, |
| 192 | 193 | 'max' => 800, |
| 193 | 194 | ], |
| 194 | 195 | ], |
| 196 | + 'default' => [ | |
| 197 | + 'size' => 420, | |
| 198 | + 'unit' => 'px', | |
| 199 | + ], | |
| 195 | 200 | 'selectors' => [ |
| 196 | 201 | '{{WRAPPER}} .upk-alex-grid .upk-style-1 .upk-item:nth-child(5n+1), {{WRAPPER}} .upk-alex-grid .upk-style-1 .upk-item:nth-child(5n+2), {{WRAPPER}} .upk-alex-grid .upk-style-3 .upk-item:nth-child(5n+2)' => 'height: {{SIZE}}{{UNIT}};', |
| 197 | 202 | ], |
| 198 | 203 | 'condition' => [ |
| @@ -211,8 +216,12 @@ | ||
| 211 | 216 | 'min' => 200, |
| 212 | 217 | 'max' => 800, |
| 213 | 218 | ], |
| 214 | 219 | ], |
| 220 | + 'default' => [ | |
| 221 | + 'size' => 280, | |
| 222 | + 'unit' => 'px', | |
| 223 | + ], | |
| 215 | 224 | 'selectors' => [ |
| 216 | 225 | '{{WRAPPER}} .upk-alex-grid .upk-style-1 .upk-item:nth-child(5n+3), {{WRAPPER}} .upk-alex-grid .upk-style-1 .upk-item:nth-child(5n+4), {{WRAPPER}} .upk-alex-grid .upk-style-1 .upk-item:nth-child(5n+5), {{WRAPPER}} .upk-alex-grid .upk-style-3 .upk-item:nth-child(5n+1), {{WRAPPER}} .upk-alex-grid .upk-style-3 .upk-item:nth-child(5n+3), {{WRAPPER}} .upk-alex-grid .upk-style-3 .upk-item:nth-child(5n+4), {{WRAPPER}} .upk-alex-grid .upk-style-3 .upk-item:nth-child(5n+5)' => 'height: {{SIZE}}{{UNIT}};', |
| 217 | 226 | ], |
| 218 | 227 | 'condition' => [ |
| @@ -244,8 +253,9 @@ | ||
| 244 | 253 | $this->add_group_control( |
| 245 | 254 | Group_Control_Image_Size::get_type(), |
| 246 | 255 | [ |
| 247 | 256 | 'name' => 'primary_thumbnail', |
| 257 | + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. | |
| 248 | 258 | 'exclude' => ['custom'], |
| 249 | 259 | 'default' => 'medium', |
| 250 | 260 | ] |
| 251 | 261 | ); |
| @@ -276,9 +286,10 @@ | ||
| 276 | 286 | 'default' => [ |
| 277 | 287 | 'size' => 5, |
| 278 | 288 | ], |
| 279 | 289 | 'condition' => [ |
| 280 | - 'grid_style' => ['1', '3'] | |
| 290 | + 'grid_style' => ['1', '3'], | |
| 291 | + 'posts_source!' => 'current_query', | |
| 281 | 292 | ] |
| 282 | 293 | ] |
| 283 | 294 | ); |
| 284 | 295 | |
| @@ -468,9 +479,9 @@ | ||
| 468 | 479 | [ |
| 469 | 480 | 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'), |
| 470 | 481 | 'type' => Controls_Manager::SWITCHER, |
| 471 | 482 | // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag |
| 472 | - 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1s look here %2s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), | |
| 483 | + 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), | |
| 473 | 484 | 'default' => 'yes', |
| 474 | 485 | ] |
| 475 | 486 | ); |
| 476 | 487 | |
| @@ -1032,9 +1043,9 @@ | ||
| 1032 | 1043 | [ |
| 1033 | 1044 | 'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1034 | 1045 | 'type' => Controls_Manager::COLOR, |
| 1035 | 1046 | 'selectors' => [ |
| 1036 | - '{{WRAPPER}} .upk-alex-grid .upk-readmore .upk-readmore-icon:before, {{WRAPPER}} .upk-alex-grid .upk-item:hover .upk-readmore .upk-readmore-icon span:before, {{WRAPPER}} .upk-alex-grid .upk-item:hover .upk-readmore .upk-readmore-icon span:after' => 'background: {{VALUE}};', | |
| 1047 | + '{{WRAPPER}} .upk-alex-grid .upk-readmore .upk-readmore-icon:before, {{WRAPPER}} .upk-alex-grid .upk-readmore .upk-readmore-icon span:before, {{WRAPPER}} .upk-alex-grid .upk-readmore .upk-readmore-icon span:after' => 'background: {{VALUE}};', | |
| 1037 | 1048 | ], |
| 1038 | 1049 | ] |
| 1039 | 1050 | ); |
| 1040 | 1051 | |
| @@ -1119,9 +1130,9 @@ | ||
| 1119 | 1130 | [ |
| 1120 | 1131 | 'label' => esc_html__('Color', 'ultimate-post-kit'), |
| 1121 | 1132 | 'type' => Controls_Manager::COLOR, |
| 1122 | 1133 | 'selectors' => [ |
| 1123 | - '{{WRAPPER}} .upk-alex-grid .upk-item:hover .upk-readmore .upk-readmore-icon:before, {{WRAPPER}} .upk-alex-grid .upk-item:hover .upk-readmore .upk-readmore-icon span:before, {{WRAPPER}} .upk-alex-grid .upk-item:hover .upk-readmore .upk-readmore-icon span:after' => 'background: {{VALUE}};', | |
| 1134 | + '{{WRAPPER}} .upk-alex-grid .upk-readmore:hover .upk-readmore-icon:before, {{WRAPPER}} .upk-alex-grid .upk-readmore:hover .upk-readmore-icon span:before, {{WRAPPER}} .upk-alex-grid .upk-readmore:hover .upk-readmore-icon span:after' => 'background: {{VALUE}};', | |
| 1124 | 1135 | ], |
| 1125 | 1136 | ] |
| 1126 | 1137 | ); |
| 1127 | 1138 | |
| @@ -1423,9 +1434,9 @@ | ||
| 1423 | 1434 | [ |
| 1424 | 1435 | 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'), |
| 1425 | 1436 | 'type' => Controls_Manager::SWITCHER, |
| 1426 | 1437 | // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag |
| 1427 | - 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1s look here %2s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), | |
| 1438 | + 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'), | |
| 1428 | 1439 | 'default' => 'yes', |
| 1429 | 1440 | 'separator' => 'before' |
| 1430 | 1441 | ] |
| 1431 | 1442 | ); |
| @@ -1459,8 +1470,9 @@ | ||
| 1459 | 1470 | [ |
| 1460 | 1471 | 'name' => 'post_format_background', |
| 1461 | 1472 | 'label' => esc_html__('Background', 'ultimate-post-kit'), |
| 1462 | 1473 | 'types' => ['classic', 'gradient'], |
| 1474 | + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. | |
| 1463 | 1475 | 'exclude' => ['image'], |
| 1464 | 1476 | 'selector' => '{{WRAPPER}} .upk-alex-grid .upk-post-format a', |
| 1465 | 1477 | 'fields_options' => [ |
| 1466 | 1478 | 'background' => [ |
| @@ -1544,22 +1556,33 @@ | ||
| 1544 | 1556 | $this->register_ajax_loadmore_style_controls(); |
| 1545 | 1557 | } |
| 1546 | 1558 | |
| 1547 | 1559 | /** |
| 1548 | - * Main query render for this widget | |
| 1549 | - * @param $posts_per_page number item query limit | |
| 1560 | + * Get post query builder arguments | |
| 1550 | 1561 | */ |
| 1551 | - public function query_posts($posts_per_page) { | |
| 1562 | + public function query_posts( $posts_per_page ) { | |
| 1563 | + $settings = $this->get_settings(); | |
| 1564 | + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0; | |
| 1565 | + $args = $this->getGroupControlQueryArgs(); | |
| 1566 | + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' ); | |
| 1552 | 1567 | |
| 1553 | - $default = $this->getGroupControlQueryArgs(); | |
| 1554 | - $args = []; | |
| 1555 | - if ($posts_per_page) { | |
| 1568 | + if ( $is_current_query ) { | |
| 1569 | + unset( $args['offset'] ); | |
| 1570 | + unset( $args['no_found_rows'] ); | |
| 1571 | + $posts_per_page = 0; | |
| 1572 | + } | |
| 1573 | + | |
| 1574 | + if ( $posts_per_page > 0 ) { | |
| 1556 | 1575 | $args['posts_per_page'] = $posts_per_page; |
| 1557 | - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page')); | |
| 1576 | + } else { | |
| 1577 | + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 ); | |
| 1558 | 1578 | } |
| 1559 | 1579 | |
| 1560 | - $args = array_merge($default, $args); | |
| 1561 | - $this->_query = new WP_Query($args); | |
| 1580 | + if ( $settings['show_pagination'] ) { | |
| 1581 | + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) ); | |
| 1582 | + } | |
| 1583 | + | |
| 1584 | + $this->_query = new \WP_Query( $args ); | |
| 1562 | 1585 | } |
| 1563 | 1586 | |
| 1564 | 1587 | public function render_readmore() { |
| 1565 | 1588 | if (!$this->get_settings('show_readmore')) { |
| @@ -1603,16 +1626,14 @@ | ||
| 1603 | 1626 | <?php endif; ?> |
| 1604 | 1627 | |
| 1605 | 1628 | <div class="upk-flex upk-flex-middle upk-date-reading-wrap"> |
| 1606 | 1629 | <?php if ('yes' === $settings['show_date']) : ?> |
| 1607 | - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1608 | - <?php $this->render_date(); ?> | |
| 1609 | - </div> | |
| 1630 | + <?php $this->render_date(); ?> | |
| 1610 | 1631 | <?php endif; ?> |
| 1611 | 1632 | |
| 1612 | 1633 | <?php if (_is_upk_pro_activated()) : |
| 1613 | 1634 | if ('yes' === $settings['show_reading_time']) : ?> |
| 1614 | - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1635 | + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 1615 | 1636 | <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?> |
| 1616 | 1637 | </div> |
| 1617 | 1638 | <?php endif; ?> |
| 1618 | 1639 | <?php endif; ?> |