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/alice-grid/widgets/alice-grid.php +52 -32 4.0.9 → 4.5.6 View file →
@@ -96,25 +96,26 @@
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',
104 105 [
105 - 'label' => __('Columns', 'ultimate-post-kit') . BDTUPK_PC,
106 + 'label' => esc_html__('Columns', 'ultimate-post-kit') . BDTUPK_PC,
106 107 'type' => Controls_Manager::SELECT,
107 108 'default' => '3',
108 109 'tablet_default' => '2',
109 110 'mobile_default' => '1',
110 111 'options' => [
111 - '1' => '1',
112 - '2' => '2',
113 - '3' => '3',
114 - '4' => '4',
115 - '5' => '5',
116 - '6' => '6',
112 + '1' => esc_html__('1', 'ultimate-post-kit'),
113 + '2' => esc_html__('2', 'ultimate-post-kit'),
114 + '3' => esc_html__('3', 'ultimate-post-kit'),
115 + '4' => esc_html__('4', 'ultimate-post-kit'),
116 + '5' => esc_html__('5', 'ultimate-post-kit'),
117 + '6' => esc_html__('6', 'ultimate-post-kit'),
117 118 ],
118 119 'selectors' => [
119 120 '{{WRAPPER}} .upk-alice-grid .upk-style-1' => $column_size,
120 121 ],
@@ -236,8 +237,9 @@
236 237 $this->add_group_control(
237 238 Group_Control_Image_Size::get_type(),
238 239 [
239 240 'name' => 'primary_thumbnail',
241 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
240 242 'exclude' => ['custom'],
241 243 'default' => 'medium',
242 244 ]
243 245 );
@@ -247,9 +249,9 @@
247 249 // Query Settings
248 250 $this->start_controls_section(
249 251 'section_post_query_builder',
250 252 [
251 - 'label' => __('Query', 'ultimate-post-kit'),
253 + 'label' => esc_html__('Query', 'ultimate-post-kit'),
252 254 'tab' => Controls_Manager::TAB_CONTENT,
253 255 ]
254 256 );
255 257
@@ -268,9 +270,10 @@
268 270 'default' => [
269 271 'size' => 6,
270 272 ],
271 273 'condition' => [
272 - 'grid_style' => ['1', '3']
274 + 'grid_style' => ['1', '3'],
275 + 'posts_source!' => 'current_query'
273 276 ]
274 277 ]
275 278 );
276 279
@@ -289,9 +292,10 @@
289 292 'default' => [
290 293 'size' => 5,
291 294 ],
292 295 'condition' => [
293 - 'grid_style' => ['2', '4']
296 + 'grid_style' => ['2', '4'],
297 + 'posts_source!' => 'current_query'
294 298 ]
295 299 ]
296 300 );
297 301
@@ -335,9 +339,9 @@
335 339
336 340 $this->add_control(
337 341 'meta_separator',
338 342 [
339 - 'label' => __('Separator', 'ultimate-post-kit'),
343 + 'label' => esc_html__('Separator', 'ultimate-post-kit'),
340 344 'type' => Controls_Manager::TEXT,
341 345 'default' => '.',
342 346 'label_block' => false,
343 347 ]
@@ -357,12 +361,12 @@
357 361
358 362 $this->add_control(
359 363 'global_link',
360 364 [
361 - 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
365 + 'label' => esc_html__('Item Wrapper Link', 'ultimate-post-kit'),
362 366 'type' => Controls_Manager::SWITCHER,
363 367 'prefix_class' => 'upk-global-link-',
364 - 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
368 + 'description' => esc_html__('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
365 369 ]
366 370 );
367 371
368 372 $this->end_controls_section();
@@ -378,9 +382,9 @@
378 382
379 383 $this->add_responsive_control(
380 384 'content_padding',
381 385 [
382 - 'label' => __('Content Padding', 'ultimate-post-kit'),
386 + 'label' => esc_html__('Content Padding', 'ultimate-post-kit'),
383 387 'type' => Controls_Manager::DIMENSIONS,
384 388 'size_units' => ['px', 'em', '%'],
385 389 'selectors' => [
386 390 '{{WRAPPER}} .upk-alice-grid .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -402,9 +406,9 @@
402 406 [
403 407 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
404 408 'type' => Controls_Manager::SWITCHER,
405 409 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
406 - 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1s look here %2s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'),
410 + 'description' => sprintf(__('This feature will not work in the Firefox browser untill you enable browser compatibility so please %1$s look here %2$s', 'ultimate-post-kit'), '<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility" target="_blank">', '</a>'),
407 411 ]
408 412 );
409 413
410 414 $this->add_control(
@@ -409,9 +413,9 @@
409 413
410 414 $this->add_control(
411 415 'overlay_blur_level',
412 416 [
413 - 'label' => __('Blur Level', 'ultimate-post-kit'),
417 + 'label' => esc_html__('Blur Level', 'ultimate-post-kit'),
414 418 'type' => Controls_Manager::SLIDER,
415 419 'range' => [
416 420 'px' => [
417 421 'min' => 0,
@@ -464,9 +468,9 @@
464 468
465 469 $this->add_responsive_control(
466 470 'item_padding',
467 471 [
468 - 'label' => __('Padding', 'ultimate-post-kit'),
472 + 'label' => esc_html__('Padding', 'ultimate-post-kit'),
469 473 'type' => Controls_Manager::DIMENSIONS,
470 474 'size_units' => ['px', 'em', '%'],
471 475 'selectors' => [
472 476 '{{WRAPPER}} .upk-alice-grid .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -493,9 +497,9 @@
493 497
494 498 $this->add_control(
495 499 'overlay_blur_level_hover',
496 500 [
497 - 'label' => __('Blur Level', 'ultimate-post-kit'),
501 + 'label' => esc_html__('Blur Level', 'ultimate-post-kit'),
498 502 'type' => Controls_Manager::SLIDER,
499 503 'range' => [
500 504 'px' => [
501 505 'min' => 0,
@@ -643,9 +647,9 @@
643 647 $this->add_group_control(
644 648 Group_Control_Text_Shadow::get_type(),
645 649 [
646 650 'name' => 'title_text_shadow',
647 - 'label' => __('Text Shadow', 'ultimate-post-kit'),
651 + 'label' => esc_html__('Text Shadow', 'ultimate-post-kit'),
648 652 'selector' => '{{WRAPPER}} .upk-alice-grid .upk-title a',
649 653 ]
650 654 );
651 655
@@ -929,21 +933,33 @@
929 933 $this->register_ajax_loadmore_style_controls();
930 934 }
931 935
932 936 /**
933 - * Main query render for this widget
934 - * @param $posts_per_page number item query limit
937 + * Get post query builder arguments
935 938 */
936 - public function query_posts($posts_per_page) {
939 + public function query_posts( $posts_per_page ) {
940 + $settings = $this->get_settings();
941 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
942 + $args = $this->getGroupControlQueryArgs();
943 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
937 944
938 - $default = $this->getGroupControlQueryArgs();
939 - if ($posts_per_page) {
945 + if ( $is_current_query ) {
946 + unset( $args['offset'] );
947 + unset( $args['no_found_rows'] );
948 + $posts_per_page = 0;
949 + }
950 +
951 + if ( $posts_per_page > 0 ) {
940 952 $args['posts_per_page'] = $posts_per_page;
941 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
953 + } else {
954 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
942 955 }
943 956
944 - $args = array_merge($default, $args);
945 - $this->_query = new WP_Query($args);
957 + if ( $settings['show_pagination'] ) {
958 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
959 + }
960 +
961 + $this->_query = new \WP_Query( $args );
946 962 }
947 963
948 964 public function render_author() {
949 965
@@ -954,13 +970,15 @@
954 970 ?>
955 971
956 972 <div class="upk-author">
957 973 <span><?php echo esc_html_x('by', 'Frontend', 'ultimate-post-kit') ?></span>
958 - <a href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>">
974 + <a
975 + href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"
976 + aria-label="<?php echo esc_attr( 'View all posts by ' . get_the_author() ); ?>"
977 + >
959 978 <?php echo esc_html( get_the_author() ) ?>
960 979 </a>
961 980 </div>
962 -
963 981 <?php
964 982 }
965 983
966 984 public function render_post_grid_item($post_id, $image_size) {
@@ -984,15 +1002,15 @@
984 1002
985 1003 <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
986 1004 <div class="upk-meta">
987 1005 <?php $this->render_author(); ?>
988 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1006 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
989 1007 <?php $this->render_date(); ?>
990 1008 </div>
991 1009 <?php if (_is_upk_pro_activated()) :
992 1010 if ('yes' === $settings['show_reading_time']) : ?>
993 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
994 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1011 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1012 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
995 1013 </div>
996 1014 <?php endif; ?>
997 1015 <?php endif; ?>
998 1016 </div>
@@ -1070,8 +1088,10 @@
1070 1088 'show_time' => isset($settings['show_time']) ? $settings['show_time'] : 'no',
1071 1089 'show_category' => isset($settings['show_category']) ? $settings['show_category'] : 'yes',
1072 1090 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
1073 1091 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
1092 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
1093 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
1074 1094 'meta_separator' => isset($settings['meta_separator']) ? $settings['meta_separator'] : '|',
1075 1095 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
1076 1096 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
1077 1097 'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no',