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/buzz-list/widgets/buzz-list.php +34 -16 4.0.9 → 4.5.6 View file →
@@ -49,9 +49,9 @@
49 49 public function get_style_depends() {
50 50 if ($this->upk_is_edit_mode()) {
51 51 return ['upk-all-styles'];
52 52 } else {
53 - return ['upk-buzz-list'];
53 + return ['upk-font', 'upk-buzz-list'];
54 54 }
55 55 }
56 56
57 57 public function get_script_depends() {
@@ -128,8 +128,9 @@
128 128 $this->add_group_control(
129 129 Group_Control_Image_Size::get_type(),
130 130 [
131 131 'name' => 'primary_thumbnail',
132 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
132 133 'exclude' => ['custom'],
133 134 'default' => 'medium',
134 135 ]
135 136 );
@@ -233,8 +234,11 @@
233 234 ],
234 235 'default' => [
235 236 'size' => 6,
236 237 ],
238 + 'condition' => [
239 + 'posts_source!' => 'current_query',
240 + ]
237 241 ]
238 242 );
239 243
240 244 $this->register_query_builder_controls();
@@ -799,20 +803,33 @@
799 803 $this->register_ajax_loadmore_style_controls();
800 804 }
801 805
802 806 /**
803 - * Main query render for this widget
804 - * @param $posts_per_page number item query limit
807 + * Get post query builder arguments
805 808 */
806 - public function query_posts($posts_per_page) {
809 + public function query_posts( $posts_per_page ) {
810 + $settings = $this->get_settings();
811 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
812 + $args = $this->getGroupControlQueryArgs();
813 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
807 814
808 - $default = $this->getGroupControlQueryArgs();
809 - if ($posts_per_page) {
815 + if ( $is_current_query ) {
816 + unset( $args['offset'] );
817 + unset( $args['no_found_rows'] );
818 + $posts_per_page = 0;
819 + }
820 +
821 + if ( $posts_per_page > 0 ) {
810 822 $args['posts_per_page'] = $posts_per_page;
811 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
823 + } else {
824 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
812 825 }
813 - $args = array_merge($default, $args);
814 - $this->_query = new WP_Query($args);
826 +
827 + if ( $settings['show_pagination'] ) {
828 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
829 + }
830 +
831 + $this->_query = new \WP_Query( $args );
815 832 }
816 833
817 834 public function render_author() {
818 835
@@ -833,13 +850,12 @@
833 850
834 851 if (!$this->get_settings('show_comments')) {
835 852 return;
836 853 }
837 - ?>
854 + ?>
838 855
839 856 <div class="upk-comments">
840 - <?php echo get_comments_number($id) ?>
841 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
857 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
842 858 </div>
843 859
844 860 <?php
845 861 }
@@ -869,9 +885,9 @@
869 885 <?php $this->render_author(); ?>
870 886 <?php endif; ?>
871 887
872 888 <?php if ($settings['show_date']) : ?>
873 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
889 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
874 890 <?php $this->render_date(); ?>
875 891 </div>
876 892 <?php endif; ?>
877 893
@@ -876,16 +892,16 @@
876 892 <?php endif; ?>
877 893
878 894 <?php if (_is_upk_pro_activated()) :
879 895 if ('yes' === $settings['show_reading_time']) : ?>
880 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
881 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
896 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
897 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
882 898 </div>
883 899 <?php endif; ?>
884 900 <?php endif; ?>
885 901
886 902 <?php if ($settings['show_comments']) : ?>
887 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
903 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
888 904 <?php $this->render_comments($post_id); ?>
889 905 </div>
890 906 <?php endif; ?>
891 907
@@ -959,8 +975,10 @@
959 975 'human_diff_time' => isset($settings['human_diff_time']) ? $settings['human_diff_time'] : 'no',
960 976 'human_diff_time_short' => isset($settings['human_diff_time_short']) ? $settings['human_diff_time_short'] : 'no',
961 977 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
962 978 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
979 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
980 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
963 981 'primary_thumbnail_size' => isset($settings['primary_thumbnail_size']) ? $settings['primary_thumbnail_size'] : 'medium',
964 982 'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no',
965 983 'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no',
966 984 ];