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/elite-grid/widgets/elite-grid.php +32 -15 4.1.2 → 4.5.6 View file →
@@ -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',
@@ -190,8 +191,9 @@
190 191 $this->add_group_control(
191 192 Group_Control_Image_Size::get_type(),
192 193 [
193 194 'name' => 'primary_thumbnail',
195 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
194 196 'exclude' => ['custom'],
195 197 'default' => 'medium',
196 198 ]
197 199 );
@@ -222,9 +224,10 @@
222 224 'default' => [
223 225 'size' => 6,
224 226 ],
225 227 'condition' => [
226 - 'grid_style' => ['1']
228 + 'grid_style' => ['1'],
229 + 'posts_source!' => 'current_query'
227 230 ]
228 231 ]
229 232 );
230 233
@@ -243,9 +246,10 @@
243 246 'default' => [
244 247 'size' => 5,
245 248 ],
246 249 'condition' => [
247 - 'grid_style' => ['2']
250 + 'grid_style' => ['2'],
251 + 'posts_source!' => 'current_query'
248 252 ]
249 253 ]
250 254 );
251 255
@@ -264,9 +268,10 @@
264 268 'default' => [
265 269 'size' => 4,
266 270 ],
267 271 'condition' => [
268 - 'grid_style' => ['3']
272 + 'grid_style' => ['3'],
273 + 'posts_source!' => 'current_query'
269 274 ]
270 275 ]
271 276 );
272 277
@@ -1201,21 +1206,33 @@
1201 1206 $this->register_ajax_loadmore_style_controls();
1202 1207 }
1203 1208
1204 1209 /**
1205 - * Main query render for this widget
1206 - * @param $posts_per_page number item query limit
1210 + * Get post query builder arguments
1207 1211 */
1208 - public function query_posts($posts_per_page) {
1212 + public function query_posts( $posts_per_page ) {
1213 + $settings = $this->get_settings();
1214 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1215 + $args = $this->getGroupControlQueryArgs();
1216 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1209 1217
1210 - $default = $this->getGroupControlQueryArgs();
1211 - $args = [];
1212 - if ($posts_per_page) {
1218 + if ( $is_current_query ) {
1219 + unset( $args['offset'] );
1220 + unset( $args['no_found_rows'] );
1221 + $posts_per_page = 0;
1222 + }
1223 +
1224 + if ( $posts_per_page > 0 ) {
1213 1225 $args['posts_per_page'] = $posts_per_page;
1214 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1226 + } else {
1227 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1215 1228 }
1216 - $args = array_merge($default, $args);
1217 - $this->_query = new WP_Query($args);
1229 +
1230 + if ( $settings['show_pagination'] ) {
1231 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1232 + }
1233 +
1234 + $this->_query = new \WP_Query( $args );
1218 1235 }
1219 1236
1220 1237 public function render_author() {
1221 1238
@@ -1262,9 +1279,9 @@
1262 1279
1263 1280 <span class="author-depertment">
1264 1281 <?php
1265 1282 $aid = get_the_author_meta('ID');
1266 - echo ucwords(get_user_role($aid));
1283 + echo esc_html( get_user_role( $aid ) );
1267 1284 ?>
1268 1285 </span>
1269 1286 </div>
1270 1287 </div>
@@ -1279,9 +1296,9 @@
1279 1296 <?php $this->render_date(); ?>
1280 1297
1281 1298 <?php if (_is_upk_pro_activated()) :
1282 1299 if ('yes' === $settings['show_reading_time']) : ?>
1283 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1300 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1284 1301 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1285 1302 </div>
1286 1303 <?php endif; ?>
1287 1304 <?php endif; ?>
@@ -1310,9 +1327,9 @@
1310 1327 <?php $this->render_date(); ?>
1311 1328
1312 1329 <?php if (_is_upk_pro_activated()) :
1313 1330 if ('yes' === $settings['show_reading_time']) : ?>
1314 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1331 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1315 1332 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1316 1333 </div>
1317 1334 <?php endif; ?>
1318 1335 <?php endif; ?>