| @@ -96,8 +96,9 @@ | ||
| 96 | 96 | ], |
| 97 | 97 | ] |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration. | |
| 100 | 101 | $column_size = apply_filters('upk_column_size', ''); |
| 101 | 102 | |
| 102 | 103 | $this->add_responsive_control( |
| 103 | 104 | 'columns', |
| @@ -236,8 +237,9 @@ | ||
| 236 | 237 | $this->add_group_control( |
| 237 | 238 | Group_Control_Image_Size::get_type(), |
| 238 | 239 | [ |
| 239 | 240 | 'name' => 'primary_thumbnail', |
| 241 | + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. | |
| 240 | 242 | 'exclude' => ['custom'], |
| 241 | 243 | 'default' => 'medium', |
| 242 | 244 | ] |
| 243 | 245 | ); |
| @@ -268,9 +270,10 @@ | ||
| 268 | 270 | 'default' => [ |
| 269 | 271 | 'size' => 6, |
| 270 | 272 | ], |
| 271 | 273 | 'condition' => [ |
| 272 | - 'grid_style' => ['1', '3'] | |
| 274 | + 'grid_style' => ['1', '3'], | |
| 275 | + 'posts_source!' => 'current_query' | |
| 273 | 276 | ] |
| 274 | 277 | ] |
| 275 | 278 | ); |
| 276 | 279 | |
| @@ -289,9 +292,10 @@ | ||
| 289 | 292 | 'default' => [ |
| 290 | 293 | 'size' => 5, |
| 291 | 294 | ], |
| 292 | 295 | 'condition' => [ |
| 293 | - 'grid_style' => ['2', '4'] | |
| 296 | + 'grid_style' => ['2', '4'], | |
| 297 | + 'posts_source!' => 'current_query' | |
| 294 | 298 | ] |
| 295 | 299 | ] |
| 296 | 300 | ); |
| 297 | 301 | |
| @@ -402,9 +406,9 @@ | ||
| 402 | 406 | [ |
| 403 | 407 | 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'), |
| 404 | 408 | 'type' => Controls_Manager::SWITCHER, |
| 405 | 409 | // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag |
| 406 | - '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>'), | |
| 410 | + '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>'), | |
| 407 | 411 | ] |
| 408 | 412 | ); |
| 409 | 413 | |
| 410 | 414 | $this->add_control( |
| @@ -929,22 +933,33 @@ | ||
| 929 | 933 | $this->register_ajax_loadmore_style_controls(); |
| 930 | 934 | } |
| 931 | 935 | |
| 932 | 936 | /** |
| 933 | - * Main query render for this widget | |
| 934 | - * @param $posts_per_page number item query limit | |
| 937 | + * Get post query builder arguments | |
| 935 | 938 | */ |
| 936 | - public function query_posts($posts_per_page) { | |
| 939 | + public function query_posts( $posts_per_page ) { | |
| 940 | + $settings = $this->get_settings(); | |
| 941 | + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0; | |
| 942 | + $args = $this->getGroupControlQueryArgs(); | |
| 943 | + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' ); | |
| 937 | 944 | |
| 938 | - $default = $this->getGroupControlQueryArgs(); | |
| 939 | - $args = []; | |
| 940 | - if ($posts_per_page) { | |
| 945 | + if ( $is_current_query ) { | |
| 946 | + unset( $args['offset'] ); | |
| 947 | + unset( $args['no_found_rows'] ); | |
| 948 | + $posts_per_page = 0; | |
| 949 | + } | |
| 950 | + | |
| 951 | + if ( $posts_per_page > 0 ) { | |
| 941 | 952 | $args['posts_per_page'] = $posts_per_page; |
| 942 | - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page')); | |
| 953 | + } else { | |
| 954 | + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 ); | |
| 943 | 955 | } |
| 944 | 956 | |
| 945 | - $args = array_merge($default, $args); | |
| 946 | - $this->_query = new WP_Query($args); | |
| 957 | + if ( $settings['show_pagination'] ) { | |
| 958 | + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) ); | |
| 959 | + } | |
| 960 | + | |
| 961 | + $this->_query = new \WP_Query( $args ); | |
| 947 | 962 | } |
| 948 | 963 | |
| 949 | 964 | public function render_author() { |
| 950 | 965 | |
| @@ -987,14 +1002,14 @@ | ||
| 987 | 1002 | |
| 988 | 1003 | <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?> |
| 989 | 1004 | <div class="upk-meta"> |
| 990 | 1005 | <?php $this->render_author(); ?> |
| 991 | - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1006 | + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 992 | 1007 | <?php $this->render_date(); ?> |
| 993 | 1008 | </div> |
| 994 | 1009 | <?php if (_is_upk_pro_activated()) : |
| 995 | 1010 | if ('yes' === $settings['show_reading_time']) : ?> |
| 996 | - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1011 | + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 997 | 1012 | <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?> |
| 998 | 1013 | </div> |
| 999 | 1014 | <?php endif; ?> |
| 1000 | 1015 | <?php endif; ?> |