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/alter-grid/widgets/alter-grid.php +74 -40 4.0.9 → 4.5.6 View file →
@@ -97,25 +97,26 @@
97 97 ],
98 98 ]
99 99 );
100 100
101 + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- established hook name relied on across the plugin family; renaming would break integration.
101 102 $column_size = apply_filters('upk_column_size', '');
102 103
103 104 $this->add_responsive_control(
104 105 'columns',
105 106 [
106 - 'label' => __('Columns', 'ultimate-post-kit') . BDTUPK_PC,
107 + 'label' => esc_html__('Columns', 'ultimate-post-kit') . BDTUPK_PC,
107 108 'type' => Controls_Manager::SELECT,
108 109 'default' => '3',
109 110 'tablet_default' => '2',
110 111 'mobile_default' => '1',
111 112 'options' => [
112 - '1' => '1',
113 - '2' => '2',
114 - '3' => '3',
115 - '4' => '4',
116 - '5' => '5',
117 - '6' => '6',
113 + '1' => esc_html__('1', 'ultimate-post-kit'),
114 + '2' => esc_html__('2', 'ultimate-post-kit'),
115 + '3' => esc_html__('3', 'ultimate-post-kit'),
116 + '4' => esc_html__('4', 'ultimate-post-kit'),
117 + '5' => esc_html__('5', 'ultimate-post-kit'),
118 + '6' => esc_html__('6', 'ultimate-post-kit'),
118 119 ],
119 120 'selectors' => [
120 121 '{{WRAPPER}} .upk-alter-grid .upk-style-1' => $column_size,
121 122 ],
@@ -211,8 +212,9 @@
211 212 $this->add_group_control(
212 213 Group_Control_Image_Size::get_type(),
213 214 [
214 215 'name' => 'primary_thumbnail',
216 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
215 217 'exclude' => ['custom'],
216 218 'default' => 'medium',
217 219 ]
218 220 );
@@ -289,9 +291,9 @@
289 291 // Query Settings
290 292 $this->start_controls_section(
291 293 'section_post_query_builder',
292 294 [
293 - 'label' => __('Query', 'ultimate-post-kit'),
295 + 'label' => esc_html__('Query', 'ultimate-post-kit'),
294 296 'tab' => Controls_Manager::TAB_CONTENT,
295 297 ]
296 298 );
297 299
@@ -310,9 +312,10 @@
310 312 'default' => [
311 313 'size' => 6,
312 314 ],
313 315 'condition' => [
314 - 'grid_style' => ['1']
316 + 'grid_style' => ['1'],
317 + 'posts_source!' => 'current_query'
315 318 ]
316 319 ]
317 320 );
318 321
@@ -331,9 +334,10 @@
331 334 'default' => [
332 335 'size' => 4,
333 336 ],
334 337 'condition' => [
335 - 'grid_style' => ['2']
338 + 'grid_style' => ['2'],
339 + 'posts_source!' => 'current_query'
336 340 ]
337 341 ]
338 342 );
339 343
@@ -352,9 +356,10 @@
352 356 'default' => [
353 357 'size' => 5,
354 358 ],
355 359 'condition' => [
356 - 'grid_style' => ['3']
360 + 'grid_style' => ['3'],
361 + 'posts_source!' => 'current_query'
357 362 ]
358 363 ]
359 364 );
360 365
@@ -385,9 +390,9 @@
385 390
386 391 $this->add_control(
387 392 'meta_separator',
388 393 [
389 - 'label' => __('Separator', 'ultimate-post-kit'),
394 + 'label' => esc_html__('Separator', 'ultimate-post-kit'),
390 395 'type' => Controls_Manager::TEXT,
391 396 'default' => '|',
392 397 'label_block' => false,
393 398 ]
@@ -472,12 +477,12 @@
472 477
473 478 $this->add_control(
474 479 'global_link',
475 480 [
476 - 'label' => __('Item Wrapper Link', 'ultimate-post-kit'),
481 + 'label' => esc_html__('Item Wrapper Link', 'ultimate-post-kit'),
477 482 'type' => Controls_Manager::SWITCHER,
478 483 'prefix_class' => 'upk-global-link-',
479 - 'description' => __('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
484 + 'description' => esc_html__('Be aware! When Item Wrapper Link activated then title link and read more link will not work', 'ultimate-post-kit'),
480 485 ]
481 486 );
482 487
483 488 $this->end_controls_section();
@@ -496,8 +501,9 @@
496 501 'readmore_text',
497 502 [
498 503 'label' => esc_html__('Read More Text', 'ultimate-post-kit'),
499 504 'type' => Controls_Manager::TEXT,
505 + 'dynamic' => [ 'active' => true ],
500 506 'default' => esc_html__('Read More', 'ultimate-post-kit'),
501 507 'placeholder' => esc_html__('Read More', 'ultimate-post-kit'),
502 508 ]
503 509 );
@@ -574,9 +580,9 @@
574 580 [
575 581 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
576 582 'type' => Controls_Manager::SWITCHER,
577 583 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
578 - '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>'),
584 + '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>'),
579 585 'default' => 'yes',
580 586 'condition' => [
581 587 'content_on_image' => 'yes'
582 588 ]
@@ -585,9 +591,9 @@
585 591
586 592 $this->add_control(
587 593 'overlay_blur_level',
588 594 [
589 - 'label' => __('Blur Level', 'ultimate-post-kit'),
595 + 'label' => esc_html__('Blur Level', 'ultimate-post-kit'),
590 596 'type' => Controls_Manager::SLIDER,
591 597 'range' => [
592 598 'px' => [
593 599 'min' => 0,
@@ -610,9 +616,9 @@
610 616
611 617 $this->add_responsive_control(
612 618 'content_padding',
613 619 [
614 - 'label' => __('Content Padding', 'ultimate-post-kit'),
620 + 'label' => esc_html__('Content Padding', 'ultimate-post-kit'),
615 621 'type' => Controls_Manager::DIMENSIONS,
616 622 'size_units' => ['px', 'em', '%'],
617 623 'selectors' => [
618 624 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -644,8 +650,9 @@
644 650 Group_Control_Background::get_type(),
645 651 [
646 652 'name' => 'itam_content_background',
647 653 'selector' => '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-content',
654 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
648 655 'exclude' => ['image'],
649 656 'condition' => [
650 657 'content_on_image' => 'yes'
651 658 ]
@@ -655,9 +662,9 @@
655 662 $this->add_group_control(
656 663 Group_Control_Border::get_type(),
657 664 [
658 665 'name' => 'item_border',
659 - 'label' => __('Border', 'ultimate-post-kit'),
666 + 'label' => esc_html__('Border', 'ultimate-post-kit'),
660 667 'placeholder' => '1px',
661 668 'default' => '1px',
662 669 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item',
663 670 'separator' => 'before'
@@ -708,8 +715,9 @@
708 715 Group_Control_Background::get_type(),
709 716 [
710 717 'name' => 'itam_content_hover_background',
711 718 'selector' => '{{WRAPPER}}.upk-content-on-image-yes .upk-alter-grid .upk-item:hover .upk-content',
719 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
712 720 'exclude' => ['image'],
713 721 'condition' => [
714 722 'content_on_image' => 'yes'
715 723 ]
@@ -855,9 +863,9 @@
855 863 $this->add_group_control(
856 864 Group_Control_Text_Shadow::get_type(),
857 865 [
858 866 'name' => 'title_text_shadow',
859 - 'label' => __('Text Shadow', 'ultimate-post-kit'),
867 + 'label' => esc_html__('Text Shadow', 'ultimate-post-kit'),
860 868 'selector' => '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a',
861 869 'condition' => [
862 870 'title_advanced_style' => 'yes'
863 871 ]
@@ -877,9 +885,9 @@
877 885
878 886 $this->add_responsive_control(
879 887 'title_border_radius',
880 888 [
881 - 'label' => __('Border Radius', 'ultimate-post-kit'),
889 + 'label' => esc_html__('Border Radius', 'ultimate-post-kit'),
882 890 'type' => Controls_Manager::DIMENSIONS,
883 891 'size_units' => ['px', '%'],
884 892 'selectors' => [
885 893 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -903,9 +911,9 @@
903 911
904 912 $this->add_responsive_control(
905 913 'title_text_padding',
906 914 [
907 - 'label' => __('Padding', 'ultimate-post-kit'),
915 + 'label' => esc_html__('Padding', 'ultimate-post-kit'),
908 916 'type' => Controls_Manager::DIMENSIONS,
909 917 'size_units' => ['px', 'em', '%'],
910 918 'selectors' => [
911 919 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-title a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -951,9 +959,9 @@
951 959
952 960 $this->add_responsive_control(
953 961 'text_margin',
954 962 [
955 - 'label' => __('Margin', 'ultimate-post-kit'),
963 + 'label' => esc_html__('Margin', 'ultimate-post-kit'),
956 964 'type' => Controls_Manager::DIMENSIONS,
957 965 'size_units' => ['px', 'em', '%'],
958 966 'selectors' => [
959 967 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-text-wrap .upk-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -1295,9 +1303,9 @@
1295 1303
1296 1304 $this->add_responsive_control(
1297 1305 'readmore_margin',
1298 1306 [
1299 - 'label' => __('Margin', 'ultimate-post-kit'),
1307 + 'label' => esc_html__('Margin', 'ultimate-post-kit'),
1300 1308 'type' => Controls_Manager::DIMENSIONS,
1301 1309 'size_units' => ['px', 'em', '%'],
1302 1310 'selectors' => [
1303 1311 '{{WRAPPER}} .upk-alter-grid .upk-item .upk-readmore' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
@@ -1392,9 +1400,9 @@
1392 1400
1393 1401 $this->add_control(
1394 1402 'readmore_on_image_color',
1395 1403 [
1396 - 'label' => __('Color', 'ultimate-post-kit'),
1404 + 'label' => esc_html__('Color', 'ultimate-post-kit'),
1397 1405 'type' => Controls_Manager::COLOR,
1398 1406 'selectors' => [
1399 1407 '{{WRAPPER}} .upk-alter-grid .upk-readmore-on-image .upk-readmore-icon:before, {{WRAPPER}} .upk-alter-grid .upk-item:hover .upk-readmore-on-image .upk-readmore-icon span:before, {{WRAPPER}} .upk-alter-grid .upk-item:hover .upk-readmore-on-image .upk-readmore-icon span:after' => 'background: {{VALUE}};',
1400 1408 ],
@@ -1570,20 +1578,33 @@
1570 1578 $this->register_ajax_loadmore_style_controls();
1571 1579 }
1572 1580
1573 1581 /**
1574 - * Main query render for this widget
1575 - * @param $posts_per_page number item query limit
1582 + * Get post query builder arguments
1576 1583 */
1577 - public function query_posts($posts_per_page) {
1584 + public function query_posts( $posts_per_page ) {
1585 + $settings = $this->get_settings();
1586 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1587 + $args = $this->getGroupControlQueryArgs();
1588 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1578 1589
1579 - $default = $this->getGroupControlQueryArgs();
1580 - if ($posts_per_page) {
1590 + if ( $is_current_query ) {
1591 + unset( $args['offset'] );
1592 + unset( $args['no_found_rows'] );
1593 + $posts_per_page = 0;
1594 + }
1595 +
1596 + if ( $posts_per_page > 0 ) {
1581 1597 $args['posts_per_page'] = $posts_per_page;
1582 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1598 + } else {
1599 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1583 1600 }
1584 - $args = array_merge($default, $args);
1585 - $this->_query = new WP_Query($args);
1601 +
1602 + if ( $settings['show_pagination'] ) {
1603 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1604 + }
1605 +
1606 + $this->_query = new \WP_Query( $args );
1586 1607 }
1587 1608
1588 1609 public function render_readmore() {
1589 1610 $settings = $this->get_settings_for_display();
@@ -1591,9 +1612,13 @@
1591 1612 $animation = ($this->get_settings('readmore_hover_animation')) ? ' elementor-animation-' . $this->get_settings('readmore_hover_animation') : '';
1592 1613
1593 1614 ?>
1594 1615
1595 - <a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore upk-display-inline-block <?php echo esc_attr($animation); ?>">
1616 + <a
1617 + href="<?php echo esc_url(get_permalink()); ?>"
1618 + class="upk-readmore upk-display-inline-block <?php echo esc_attr($animation); ?>"
1619 + aria-label="<?php echo esc_attr__( 'Read More Button', 'ultimate-post-kit' ); ?>"
1620 + >
1596 1621 <?php echo esc_html($this->get_settings('readmore_text')); ?>
1597 1622
1598 1623 <?php if ($settings['readmore_icon']['value']) : ?>
1599 1624 <span class="upk-button-icon-align-<?php echo esc_attr($this->get_settings('readmore_icon_align')); ?>">
@@ -1606,9 +1631,13 @@
1606 1631
1607 1632 public function render_readmore_on_image() {
1608 1633
1609 1634 ?>
1610 - <a href="<?php echo esc_url(get_permalink()); ?>" class="upk-readmore-on-image">
1635 + <a
1636 + href="<?php echo esc_url(get_permalink()); ?>"
1637 + class="upk-readmore-on-image"
1638 + aria-label="<?php echo esc_attr__( 'Read More Button', 'ultimate-post-kit' ); ?>"
1639 + >
1611 1640 <span class="upk-readmore-icon"><span></span></span>
1612 1641 </a>
1613 1642 <?php
1614 1643 }
@@ -1654,17 +1683,20 @@
1654 1683
1655 1684 <?php if ($settings['show_author'] or $settings['show_date'] or $settings['show_reading_time']) : ?>
1656 1685 <div class="upk-meta">
1657 1686 <?php if ($settings['show_author']) : ?>
1658 - <div class="upk-blog-author" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1659 - <a class="author-name" href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>">
1687 + <div class="upk-blog-author" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1688 + <a
1689 + class="author-name"
1690 + href="<?php echo esc_url( get_author_posts_url(get_the_author_meta('ID')) ); ?>"
1691 + aria-label="<?php echo esc_attr( 'View all posts by ' . get_the_author() ); ?>"
1692 + >
1660 1693 <?php echo esc_html( get_the_author() ) ?>
1661 1694 </a>
1662 1695 </div>
1663 1696 <?php endif; ?>
1664 -
1665 1697 <?php if ('yes' === $settings['show_date']) : ?>
1666 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1698 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1667 1699 <?php $this->render_date(); ?>
1668 1700 </div>
1669 1701 <?php endif; ?>
1670 1702
@@ -1669,10 +1701,10 @@
1669 1701 <?php endif; ?>
1670 1702
1671 1703 <?php if (_is_upk_pro_activated()) :
1672 1704 if ('yes' === $settings['show_reading_time']) : ?>
1673 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1674 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1705 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1706 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1675 1707 </div>
1676 1708 <?php endif; ?>
1677 1709 <?php endif; ?>
1678 1710 </div>
@@ -1759,8 +1791,10 @@
1759 1791 'readmore_icon' => isset( $settings['readmore_icon'] ) ? $settings['readmore_icon'] : '',
1760 1792 'readmore_icon_align' => isset( $settings['readmore_icon_align'] ) ? $settings['readmore_icon_align'] : 'right',
1761 1793 'show_reading_time' => isset( $settings['show_reading_time'] ) ? $settings['show_reading_time'] : 'no',
1762 1794 'avg_reading_speed' => isset( $settings['avg_reading_speed'] ) ? $settings['avg_reading_speed'] : 200,
1795 + 'hide_seconds' => isset( $settings['hide_seconds'] ) ? $settings['hide_seconds'] : 'no',
1796 + 'hide_minutes' => isset( $settings['hide_minutes'] ) ? $settings['hide_minutes'] : 'no',
1763 1797 'meta_separator' => isset( $settings['meta_separator'] ) ? $settings['meta_separator'] : '|',
1764 1798 'human_diff_time' => isset( $settings['human_diff_time'] ) ? $settings['human_diff_time'] : 'no',
1765 1799 'human_diff_time_short' => isset( $settings['human_diff_time_short'] ) ? $settings['human_diff_time_short'] : 'no',
1766 1800 'show_post_format' => isset( $settings['show_post_format'] ) ? $settings['show_post_format'] : 'no',