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/scott-list/widgets/scott-list.php +34 -16 4.0.9 → 4.5.6 View file →
@@ -140,8 +140,9 @@
140 140 $this->add_group_control(
141 141 Group_Control_Image_Size::get_type(),
142 142 [
143 143 'name' => 'primary_thumbnail',
144 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
144 145 'exclude' => ['custom'],
145 146 'default' => 'medium',
146 147 ]
147 148 );
@@ -192,8 +193,11 @@
192 193 ],
193 194 'default' => [
194 195 'size' => 3,
195 196 ],
197 + 'condition' => [
198 + 'posts_source!' => 'current_query',
199 + ]
196 200 ]
197 201 );
198 202
199 203 $this->register_query_builder_controls();
@@ -747,20 +751,33 @@
747 751 $this->register_ajax_loadmore_style_controls();
748 752 }
749 753
750 754 /**
751 - * Main query render for this widget
752 - * @param $posts_per_page number item query limit
755 + * Get post query builder arguments
753 756 */
754 - public function query_posts($posts_per_page) {
757 + public function query_posts( $posts_per_page ) {
758 + $settings = $this->get_settings();
759 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
760 + $args = $this->getGroupControlQueryArgs();
761 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
755 762
756 - $default = $this->getGroupControlQueryArgs();
757 - if ($posts_per_page) {
763 + if ( $is_current_query ) {
764 + unset( $args['offset'] );
765 + unset( $args['no_found_rows'] );
766 + $posts_per_page = 0;
767 + }
768 +
769 + if ( $posts_per_page > 0 ) {
758 770 $args['posts_per_page'] = $posts_per_page;
759 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
771 + } else {
772 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
760 773 }
761 - $args = array_merge($default, $args);
762 - $this->_query = new WP_Query($args);
774 +
775 + if ( $settings['show_pagination'] ) {
776 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
777 + }
778 +
779 + $this->_query = new \WP_Query( $args );
763 780 }
764 781
765 782 public function render_image($image_id, $size) {
766 783 $placeholder_image_src = Utils::get_placeholder_image_src();
@@ -774,9 +791,9 @@
774 791 }
775 792
776 793 ?>
777 794 <a class="upk-image-wrap" href="<?php echo esc_url(get_permalink()) ?>">
778 - <img src="<?php echo esc_url($image_src); ?>" alt="<?php echo esc_html(get_the_title()); ?>">
795 + <img src="<?php echo esc_url($image_src); ?>" alt="<?php echo esc_attr(get_the_title()); ?>">
779 796 <span class="upk-img-overlay"></span>
780 797 </a>
781 798 <?php
782 799 }
@@ -800,13 +817,12 @@
800 817
801 818 if (!$this->get_settings('show_comments')) {
802 819 return;
803 820 }
804 - ?>
821 + ?>
805 822
806 823 <div class="upk-scott-comments">
807 - <?php echo get_comments_number($id) ?>
808 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
824 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
809 825 </div>
810 826
811 827 <?php
812 828 }
@@ -830,15 +846,15 @@
830 846 <div class="upk-meta upk-flex upk-flex-middle">
831 847 <?php $this->render_author(); ?>
832 848
833 849 <?php if ($settings['show_date'] == 'yes') : ?>
834 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
850 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
835 851 <?php $this->render_date(); ?>
836 852 </div>
837 853 <?php endif; ?>
838 854
839 855 <?php if ($settings['show_comments']) : ?>
840 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
856 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
841 857 <?php $this->render_comments($post_id); ?>
842 858 </div>
843 859 <?php endif; ?>
844 860
@@ -843,10 +859,10 @@
843 859 <?php endif; ?>
844 860
845 861 <?php if (_is_upk_pro_activated()) :
846 862 if ('yes' === $settings['show_reading_time']) : ?>
847 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
848 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
863 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
864 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
849 865 </div>
850 866 <?php endif; ?>
851 867 <?php endif; ?>
852 868
@@ -918,8 +934,10 @@
918 934 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
919 935 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
920 936 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
921 937 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
938 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
939 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
922 940 'primary_thumbnail_size' => isset($settings['primary_thumbnail_size']) ? $settings['primary_thumbnail_size'] : 'medium',
923 941 'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no',
924 942 'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no',
925 943 ];