| @@ -104,8 +104,9 @@ | ||
| 104 | 104 | ], |
| 105 | 105 | ] |
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration. | |
| 108 | 109 | $column_size = apply_filters('upk_column_size', ''); |
| 109 | 110 | |
| 110 | 111 | $this->add_responsive_control( |
| 111 | 112 | 'columns', |
| @@ -263,8 +264,9 @@ | ||
| 263 | 264 | $this->add_group_control( |
| 264 | 265 | Group_Control_Image_Size::get_type(), |
| 265 | 266 | [ |
| 266 | 267 | 'name' => 'primary_thumbnail', |
| 268 | + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour. | |
| 267 | 269 | 'exclude' => ['custom'], |
| 268 | 270 | 'default' => 'medium', |
| 269 | 271 | ] |
| 270 | 272 | ); |
| @@ -295,9 +297,10 @@ | ||
| 295 | 297 | 'default' => [ |
| 296 | 298 | 'size' => 6, |
| 297 | 299 | ], |
| 298 | 300 | 'condition' => [ |
| 299 | - 'grid_style' => ['1', '2', '8', '10'] | |
| 301 | + 'grid_style' => ['1', '2', '8', '10'], | |
| 302 | + 'posts_source!' => 'current_query' | |
| 300 | 303 | ] |
| 301 | 304 | ] |
| 302 | 305 | ); |
| 303 | 306 | |
| @@ -316,9 +319,10 @@ | ||
| 316 | 319 | 'default' => [ |
| 317 | 320 | 'size' => 5, |
| 318 | 321 | ], |
| 319 | 322 | 'condition' => [ |
| 320 | - 'grid_style' => ['3', '4', '5', '6'] | |
| 323 | + 'grid_style' => ['3', '4', '5', '6'], | |
| 324 | + 'posts_source!' => 'current_query' | |
| 321 | 325 | ] |
| 322 | 326 | ] |
| 323 | 327 | ); |
| 324 | 328 | |
| @@ -337,9 +341,10 @@ | ||
| 337 | 341 | 'default' => [ |
| 338 | 342 | 'size' => 7, |
| 339 | 343 | ], |
| 340 | 344 | 'condition' => [ |
| 341 | - 'grid_style' => ['7'] | |
| 345 | + 'grid_style' => ['7'], | |
| 346 | + 'posts_source!' => 'current_query' | |
| 342 | 347 | ] |
| 343 | 348 | ] |
| 344 | 349 | ); |
| 345 | 350 | |
| @@ -358,9 +363,10 @@ | ||
| 358 | 363 | 'default' => [ |
| 359 | 364 | 'size' => 4, |
| 360 | 365 | ], |
| 361 | 366 | 'condition' => [ |
| 362 | - 'grid_style' => ['9'] | |
| 367 | + 'grid_style' => ['9'], | |
| 368 | + 'posts_source!' => 'current_query' | |
| 363 | 369 | ] |
| 364 | 370 | ] |
| 365 | 371 | ); |
| 366 | 372 | |
| @@ -449,9 +455,9 @@ | ||
| 449 | 455 | [ |
| 450 | 456 | 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'), |
| 451 | 457 | 'type' => Controls_Manager::SWITCHER, |
| 452 | 458 | // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag |
| 453 | - '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>'), | |
| 459 | + '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>'), | |
| 454 | 460 | 'default' => 'yes', |
| 455 | 461 | 'condition' => [ |
| 456 | 462 | 'content_style' => '2', |
| 457 | 463 | ] |
| @@ -790,9 +796,9 @@ | ||
| 790 | 796 | Group_Control_Typography::get_type(), |
| 791 | 797 | [ |
| 792 | 798 | 'name' => 'author_typography', |
| 793 | 799 | 'label' => esc_html__('Typography', 'ultimate-post-kit'), |
| 794 | - 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-meta', | |
| 800 | + 'selector' => '{{WRAPPER}} .upk-hazel-grid .upk-meta, {{WRAPPER}} .upk-hazel-grid .upk-meta *', | |
| 795 | 801 | ] |
| 796 | 802 | ); |
| 797 | 803 | |
| 798 | 804 | $this->end_controls_section(); |
| @@ -959,21 +965,33 @@ | ||
| 959 | 965 | $this->register_ajax_loadmore_style_controls(); |
| 960 | 966 | } |
| 961 | 967 | |
| 962 | 968 | /** |
| 963 | - * Main query render for this widget | |
| 964 | - * @param $posts_per_page number item query limit | |
| 969 | + * Get post query builder arguments | |
| 965 | 970 | */ |
| 966 | - public function query_posts($posts_per_page) { | |
| 971 | + public function query_posts( $posts_per_page ) { | |
| 972 | + $settings = $this->get_settings(); | |
| 973 | + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0; | |
| 974 | + $args = $this->getGroupControlQueryArgs(); | |
| 975 | + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' ); | |
| 967 | 976 | |
| 968 | - $default = $this->getGroupControlQueryArgs(); | |
| 969 | - $args = []; | |
| 970 | - if ($posts_per_page) { | |
| 977 | + if ( $is_current_query ) { | |
| 978 | + unset( $args['offset'] ); | |
| 979 | + unset( $args['no_found_rows'] ); | |
| 980 | + $posts_per_page = 0; | |
| 981 | + } | |
| 982 | + | |
| 983 | + if ( $posts_per_page > 0 ) { | |
| 971 | 984 | $args['posts_per_page'] = $posts_per_page; |
| 972 | - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page')); | |
| 985 | + } else { | |
| 986 | + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 ); | |
| 973 | 987 | } |
| 974 | - $args = array_merge($default, $args); | |
| 975 | - $this->_query = new WP_Query($args); | |
| 988 | + | |
| 989 | + if ( $settings['show_pagination'] ) { | |
| 990 | + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) ); | |
| 991 | + } | |
| 992 | + | |
| 993 | + $this->_query = new \WP_Query( $args ); | |
| 976 | 994 | } |
| 977 | 995 | |
| 978 | 996 | public function render_author() { |
| 979 | 997 | |
| @@ -983,9 +1001,9 @@ | ||
| 983 | 1001 | |
| 984 | 1002 | ?> |
| 985 | 1003 | |
| 986 | 1004 | <div class="upk-blog-author"> |
| 987 | - <span class="by"><?php echo esc_html_x('by', 'Frontend', 'ultimate-post-kit') ?></span> | |
| 1005 | + <span class="by"><?php echo esc_html_x('By', 'Frontend', 'ultimate-post-kit') ?></span> | |
| 988 | 1006 | <span class="upk-post-grid-author"> |
| 989 | 1007 | <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"> |
| 990 | 1008 | <?php echo esc_html( get_the_author() ) ?> |
| 991 | 1009 | </a> |
| @@ -1034,9 +1052,9 @@ | ||
| 1034 | 1052 | <div class="upk-meta"> |
| 1035 | 1053 | <?php $this->render_author(); ?> |
| 1036 | 1054 | |
| 1037 | 1055 | <?php if ($settings['show_date']) : ?> |
| 1038 | - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1056 | + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 1039 | 1057 | <div class="upk-date"> |
| 1040 | 1058 | <i class="upk-icon-calendar" aria-hidden="true"></i><?php $this->render_date(); ?> |
| 1041 | 1059 | </div> |
| 1042 | 1060 | |
| @@ -1050,9 +1068,9 @@ | ||
| 1050 | 1068 | <?php endif; ?> |
| 1051 | 1069 | |
| 1052 | 1070 | <?php if (_is_upk_pro_activated()) : |
| 1053 | 1071 | if ('yes' === $settings['show_reading_time']) : ?> |
| 1054 | - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>"> | |
| 1072 | + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>"> | |
| 1055 | 1073 | <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?> |
| 1056 | 1074 | </div> |
| 1057 | 1075 | <?php endif; ?> |
| 1058 | 1076 | <?php endif; ?> |