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/maple-grid/widgets/maple-grid.php +32 -13 4.0.9 → 4.5.6 View file →
@@ -98,8 +98,9 @@
98 98 ],
99 99 ]
100 100 );
101 101
102 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration.
102 103 $column_size = apply_filters('upk_column_size', '');
103 104
104 105 $this->add_responsive_control(
105 106 'columns',
@@ -212,8 +213,9 @@
212 213 $this->add_group_control(
213 214 Group_Control_Image_Size::get_type(),
214 215 [
215 216 'name' => 'primary_thumbnail',
217 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
216 218 'exclude' => ['custom'],
217 219 'default' => 'medium',
218 220 ]
219 221 );
@@ -271,9 +273,10 @@
271 273 'default' => [
272 274 'size' => 6,
273 275 ],
274 276 'condition' => [
275 - 'grid_style!' => ['2', '5']
277 + 'grid_style!' => ['2', '5'],
278 + 'posts_source!' => 'current_query'
276 279 ]
277 280 ]
278 281 );
279 282
@@ -292,9 +295,10 @@
292 295 'default' => [
293 296 'size' => 5,
294 297 ],
295 298 'condition' => [
296 - 'grid_style' => ['2', '5']
299 + 'grid_style' => ['2', '5'],
300 + 'posts_source!' => 'current_query'
297 301 ]
298 302 ]
299 303 );
300 304
@@ -1220,20 +1224,33 @@
1220 1224 $this->register_ajax_loadmore_style_controls();
1221 1225 }
1222 1226
1223 1227 /**
1224 - * Main query render for this widget
1225 - * @param $posts_per_page number item query limit
1228 + * Get post query builder arguments
1226 1229 */
1227 - public function query_posts($posts_per_page) {
1230 + public function query_posts( $posts_per_page ) {
1231 + $settings = $this->get_settings();
1232 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1233 + $args = $this->getGroupControlQueryArgs();
1234 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1228 1235
1229 - $default = $this->getGroupControlQueryArgs();
1230 - if ($posts_per_page) {
1236 + if ( $is_current_query ) {
1237 + unset( $args['offset'] );
1238 + unset( $args['no_found_rows'] );
1239 + $posts_per_page = 0;
1240 + }
1241 +
1242 + if ( $posts_per_page > 0 ) {
1231 1243 $args['posts_per_page'] = $posts_per_page;
1232 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1244 + } else {
1245 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1233 1246 }
1234 - $args = array_merge($default, $args);
1235 - $this->_query = new WP_Query($args);
1247 +
1248 + if ( $settings['show_pagination'] ) {
1249 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1250 + }
1251 +
1252 + $this->_query = new \WP_Query( $args );
1236 1253 }
1237 1254
1238 1255 public function render_author() {
1239 1256 $settings = $this->get_settings_for_display();
@@ -1301,9 +1318,9 @@
1301 1318 <?php $this->render_author(); ?>
1302 1319 <?php endif; ?>
1303 1320
1304 1321 <?php if ($settings['show_date'] == 'yes') : ?>
1305 - <div class="upk-blog-date" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1322 + <div class="upk-blog-date" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1306 1323 <div class="upk-blog-date">
1307 1324 <a class="date" href="#">
1308 1325 <i class="upk-icon-calendar" aria-hidden="true"></i><?php $this->render_date(); ?>
1309 1326 </a>
@@ -1319,10 +1336,10 @@
1319 1336 <?php endif; ?>
1320 1337
1321 1338 <?php if (_is_upk_pro_activated()) :
1322 1339 if ('yes' === $settings['show_reading_time']) : ?>
1323 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1324 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1340 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1341 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1325 1342 </div>
1326 1343 <?php endif; ?>
1327 1344 <?php endif; ?>
1328 1345
@@ -1411,8 +1428,10 @@
1411 1428 'show_category' => isset($settings['show_category']) ? $settings['show_category'] : 'yes',
1412 1429 'show_post_format' => isset($settings['show_post_format']) ? $settings['show_post_format'] : 'yes',
1413 1430 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
1414 1431 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
1432 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
1433 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
1415 1434 'meta_separator' => isset($settings['meta_separator']) ? $settings['meta_separator'] : '|',
1416 1435 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
1417 1436 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
1418 1437 'excerpt_length' => isset($settings['excerpt_length']) ? $settings['excerpt_length'] : 20,