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/ramble-grid/widgets/ramble-grid.php +35 -16 4.0.9 → 4.5.6 View file →
@@ -152,8 +152,9 @@
152 152 $this->add_group_control(
153 153 Group_Control_Image_Size::get_type(),
154 154 [
155 155 'name' => 'primary_thumbnail',
156 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
156 157 'exclude' => ['custom'],
157 158 'default' => 'medium',
158 159 ]
159 160 );
@@ -182,8 +183,11 @@
182 183 ],
183 184 'default' => [
184 185 'size' => 6,
185 186 ],
187 + 'condition' => [
188 + 'posts_source!' => 'current_query',
189 + ]
186 190 ]
187 191 );
188 192
189 193 $this->register_query_builder_controls();
@@ -268,8 +272,9 @@
268 272 'readmore_text',
269 273 [
270 274 'label' => esc_html__('Read More Text', 'ultimate-post-kit'),
271 275 'type' => Controls_Manager::TEXT,
276 + 'dynamic' => [ 'active' => true ],
272 277 'default' => esc_html__('Read More', 'ultimate-post-kit'),
273 278 'placeholder' => esc_html__('Read More', 'ultimate-post-kit'),
274 279 'condition' => [
275 280 'show_readmore' => 'yes',
@@ -1226,20 +1231,33 @@
1226 1231 $this->register_ajax_loadmore_style_controls();
1227 1232 }
1228 1233
1229 1234 /**
1230 - * Main query render for this widget
1231 - * @param $posts_per_page number item query limit
1235 + * Get post query builder arguments
1232 1236 */
1233 - public function query_posts($posts_per_page) {
1237 + public function query_posts( $posts_per_page ) {
1238 + $settings = $this->get_settings();
1239 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1240 + $args = $this->getGroupControlQueryArgs();
1241 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1234 1242
1235 - $default = $this->getGroupControlQueryArgs();
1236 - if ($posts_per_page) {
1243 + if ( $is_current_query ) {
1244 + unset( $args['offset'] );
1245 + unset( $args['no_found_rows'] );
1246 + $posts_per_page = 0;
1247 + }
1248 +
1249 + if ( $posts_per_page > 0 ) {
1237 1250 $args['posts_per_page'] = $posts_per_page;
1238 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1251 + } else {
1252 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1239 1253 }
1240 - $args = array_merge($default, $args);
1241 - $this->_query = new WP_Query($args);
1254 +
1255 + if ( $settings['show_pagination'] ) {
1256 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1257 + }
1258 +
1259 + $this->_query = new \WP_Query( $args );
1242 1260 }
1243 1261
1244 1262 public function render_post_meta() {
1245 1263 $settings = $this->get_settings_for_display();
@@ -1264,9 +1282,9 @@
1264 1282
1265 1283 <?php if ($settings['show_date'] or $settings['show_reading_time']) : ?>
1266 1284 <div class="upk-date-reading-time upk-flex upk-flex-middle">
1267 1285 <?php if ($settings['show_date'] == 'yes') : ?>
1268 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1286 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1269 1287 <?php $this->render_date(); ?>
1270 1288 </div>
1271 1289 <?php endif; ?>
1272 1290
@@ -1271,10 +1289,10 @@
1271 1289 <?php endif; ?>
1272 1290
1273 1291 <?php if (_is_upk_pro_activated()) :
1274 1292 if ('yes' === $settings['show_reading_time']) : ?>
1275 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1276 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1293 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1294 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1277 1295 </div>
1278 1296 <?php endif; ?>
1279 1297 <?php endif; ?>
1280 1298
@@ -1293,13 +1311,12 @@
1293 1311
1294 1312 if (!$this->get_settings('show_comments')) {
1295 1313 return;
1296 1314 }
1297 - ?>
1315 + ?>
1298 1316
1299 1317 <div class="upk-comments">
1300 - <?php echo get_comments_number($id) ?>
1301 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
1318 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1302 1319 </div>
1303 1320
1304 1321 <?php
1305 1322 }
@@ -1313,14 +1330,14 @@
1313 1330
1314 1331 $animation = ($this->get_settings('readmore_hover_animation')) ? ' elementor-animation-' . $this->get_settings('readmore_hover_animation') : '';
1315 1332
1316 1333 ?>
1317 - <a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore <?php echo esc_html($animation); ?>">
1334 + <a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore <?php echo esc_attr($animation); ?>">
1318 1335 <span class="upk-flex upk-flex-middle">
1319 1336 <?php echo esc_html($this->get_settings('readmore_text')); ?>
1320 1337
1321 1338 <?php if ($settings['readmore_icon']['value']) : ?>
1322 - <span class="upk-readmore-btn-icon upk-flex-align-<?php echo esc_html($this->get_settings('icon_align')); ?>">
1339 + <span class="upk-readmore-btn-icon upk-flex-align-<?php echo esc_attr($this->get_settings('icon_align')); ?>">
1323 1340
1324 1341 <?php Icons_Manager::render_icon($settings['readmore_icon'], ['aria-hidden' => 'true', 'class' => 'fa-fw']); ?>
1325 1342
1326 1343 </span>
@@ -1440,8 +1457,10 @@
1440 1457 'show_post_format' => isset($settings['show_post_format']) ? $settings['show_post_format'] : 'yes',
1441 1458 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
1442 1459 'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no',
1443 1460 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
1461 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
1462 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
1444 1463 'meta_separator' => isset($settings['meta_separator']) ? $settings['meta_separator'] : '|',
1445 1464 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
1446 1465 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
1447 1466 'excerpt_length' => isset($settings['excerpt_length']) ? $settings['excerpt_length'] : 20,