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/fanel-list/widgets/fanel-list.php +29 -14 4.1.2 → 4.5.6 View file →
@@ -133,8 +133,9 @@
133 133 $this->add_group_control(
134 134 Group_Control_Image_Size::get_type(),
135 135 [
136 136 'name' => 'primary_thumbnail',
137 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
137 138 'exclude' => ['custom'],
138 139 'default' => 'medium',
139 140 ]
140 141 );
@@ -163,8 +164,11 @@
163 164 ],
164 165 'default' => [
165 166 'size' => 6,
166 167 ],
168 + 'condition' => [
169 + 'posts_source!' => 'current_query',
170 + ]
167 171 ]
168 172 );
169 173
170 174 $this->register_query_builder_controls();
@@ -1134,21 +1138,33 @@
1134 1138 $this->register_ajax_loadmore_style_controls();
1135 1139 }
1136 1140
1137 1141 /**
1138 - * Main query render for this widget
1139 - * @param $posts_per_page number item query limit
1142 + * Get post query builder arguments
1140 1143 */
1141 - public function query_posts($posts_per_page) {
1144 + public function query_posts( $posts_per_page ) {
1145 + $settings = $this->get_settings();
1146 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1147 + $args = $this->getGroupControlQueryArgs();
1148 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1142 1149
1143 - $default = $this->getGroupControlQueryArgs();
1144 - $args = [];
1145 - if ($posts_per_page) {
1150 + if ( $is_current_query ) {
1151 + unset( $args['offset'] );
1152 + unset( $args['no_found_rows'] );
1153 + $posts_per_page = 0;
1154 + }
1155 +
1156 + if ( $posts_per_page > 0 ) {
1146 1157 $args['posts_per_page'] = $posts_per_page;
1147 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1158 + } else {
1159 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1148 1160 }
1149 - $args = array_merge($default, $args);
1150 - $this->_query = new WP_Query($args);
1161 +
1162 + if ( $settings['show_pagination'] ) {
1163 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1164 + }
1165 +
1166 + $this->_query = new \WP_Query( $args );
1151 1167 }
1152 1168
1153 1169 public function render_author() {
1154 1170
@@ -1169,13 +1185,12 @@
1169 1185
1170 1186 if (!$this->get_settings('show_comments')) {
1171 1187 return;
1172 1188 }
1173 - ?>
1189 + ?>
1174 1190
1175 1191 <div class="upk-fanel-comments">
1176 - <?php echo get_comments_number($id) ?>
1177 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
1192 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1178 1193 </div>
1179 1194
1180 1195 <?php
1181 1196 }
@@ -1223,9 +1238,9 @@
1223 1238 <?php if ($settings['show_author']) : ?>
1224 1239 <?php $this->render_author(); ?>
1225 1240 <?php endif; ?>
1226 1241 <?php if ($settings['show_comments']) : ?>
1227 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1242 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1228 1243 <?php $this->render_comments($post_id); ?>
1229 1244 </div>
1230 1245 <?php endif; ?>
1231 1246
@@ -1230,9 +1245,9 @@
1230 1245 <?php endif; ?>
1231 1246
1232 1247 <?php if (_is_upk_pro_activated()) :
1233 1248 if ('yes' === $settings['show_reading_time']) : ?>
1234 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1249 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1235 1250 <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1236 1251 </div>
1237 1252 <?php endif; ?>
1238 1253 <?php endif; ?>