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 +33 -15 4.0.9 → 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,20 +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 - 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 ) {
1045 1057 $args['posts_per_page'] = $posts_per_page;
1046 - $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 );
1047 1060 }
1048 - $args = array_merge($default, $args);
1049 - $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 );
1050 1067 }
1051 1068
1052 1069 public function print_category_output($output) {
1053 1070
@@ -1132,13 +1149,12 @@
1132 1149
1133 1150 if (!$this->get_settings('show_comments')) {
1134 1151 return;
1135 1152 }
1136 - ?>
1153 + ?>
1137 1154
1138 1155 <div class="upk-featured-comments">
1139 - <?php echo get_comments_number($id) ?>
1140 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
1156 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1141 1157 </div>
1142 1158
1143 1159 <?php
1144 1160 }
@@ -1173,21 +1189,21 @@
1173 1189 <?php if ($settings['show_author']) : ?>
1174 1190 <?php $this->render_author(); ?>
1175 1191 <?php endif; ?>
1176 1192 <?php if ($settings['show_date']) : ?>
1177 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1193 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1178 1194 <?php $this->render_date(); ?>
1179 1195 </div>
1180 1196 <?php endif; ?>
1181 1197 <?php if ($settings['show_comments']) : ?>
1182 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1198 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1183 1199 <?php $this->render_comments($post_id); ?>
1184 1200 </div>
1185 1201 <?php endif; ?>
1186 1202 <?php if (_is_upk_pro_activated()) :
1187 1203 if ('yes' === $settings['show_reading_time']) : ?>
1188 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1189 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1204 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
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' ) ); ?>
1190 1206 </div>
1191 1207 <?php endif; ?>
1192 1208 <?php endif; ?>
1193 1209 </div>
@@ -1265,8 +1281,10 @@
1265 1281 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
1266 1282 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
1267 1283 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
1268 1284 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
1285 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
1286 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
1269 1287 'primary_thumbnail_size' => isset($settings['primary_thumbnail_size']) ? $settings['primary_thumbnail_size'] : 'medium',
1270 1288 'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no',
1271 1289 'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no',
1272 1290 ];