PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.5.6
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.5.6
4.5.6 4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 All 148 releases
← All changes | modules/featured-list/widgets/featured-list.php +30 -15 4.1.2 → 4.5.6 View file →
@@ -119,8 +119,9 @@
119 119 $this->add_group_control(
120 120 Group_Control_Image_Size::get_type(),
121 121 [
122 122 'name' => 'primary_thumbnail',
123 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
123 124 'exclude' => ['custom'],
124 125 'default' => 'medium',
125 126 ]
126 127 );
@@ -232,8 +233,11 @@
232 233 ],
233 234 'default' => [
234 235 'size' => 4,
235 236 ],
237 + 'condition' => [
238 + 'posts_source!' => 'current_query',
239 + ]
236 240 ]
237 241 );
238 242
239 243 $this->register_query_builder_controls();
@@ -1034,21 +1038,33 @@
1034 1038 $this->register_ajax_loadmore_style_controls();
1035 1039 }
1036 1040
1037 1041 /**
1038 - * Main query render for this widget
1039 - * @param $posts_per_page number item query limit
1042 + * Get post query builder arguments
1040 1043 */
1041 - public function query_posts($posts_per_page) {
1044 + public function query_posts( $posts_per_page ) {
1045 + $settings = $this->get_settings();
1046 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1047 + $args = $this->getGroupControlQueryArgs();
1048 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1042 1049
1043 - $default = $this->getGroupControlQueryArgs();
1044 - $args = [];
1045 - if ($posts_per_page) {
1050 + if ( $is_current_query ) {
1051 + unset( $args['offset'] );
1052 + unset( $args['no_found_rows'] );
1053 + $posts_per_page = 0;
1054 + }
1055 +
1056 + if ( $posts_per_page > 0 ) {
1046 1057 $args['posts_per_page'] = $posts_per_page;
1047 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1058 + } else {
1059 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1048 1060 }
1049 - $args = array_merge($default, $args);
1050 - $this->_query = new WP_Query($args);
1061 +
1062 + if ( $settings['show_pagination'] ) {
1063 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1064 + }
1065 +
1066 + $this->_query = new \WP_Query( $args );
1051 1067 }
1052 1068
1053 1069 public function print_category_output($output) {
1054 1070
@@ -1133,13 +1149,12 @@
1133 1149
1134 1150 if (!$this->get_settings('show_comments')) {
1135 1151 return;
1136 1152 }
1137 - ?>
1153 + ?>
1138 1154
1139 1155 <div class="upk-featured-comments">
1140 - <?php echo get_comments_number($id) ?>
1141 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
1156 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1142 1157 </div>
1143 1158
1144 1159 <?php
1145 1160 }
@@ -1174,20 +1189,20 @@
1174 1189 <?php if ($settings['show_author']) : ?>
1175 1190 <?php $this->render_author(); ?>
1176 1191 <?php endif; ?>
1177 1192 <?php if ($settings['show_date']) : ?>
1178 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1193 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1179 1194 <?php $this->render_date(); ?>
1180 1195 </div>
1181 1196 <?php endif; ?>
1182 1197 <?php if ($settings['show_comments']) : ?>
1183 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1198 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1184 1199 <?php $this->render_comments($post_id); ?>
1185 1200 </div>
1186 1201 <?php endif; ?>
1187 1202 <?php if (_is_upk_pro_activated()) :
1188 1203 if ('yes' === $settings['show_reading_time']) : ?>
1189 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1204 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1190 1205 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1191 1206 </div>
1192 1207 <?php endif; ?>
1193 1208 <?php endif; ?>