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 +32 -14 4.0.9 → 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,20 +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 - 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 ) {
1145 1157 $args['posts_per_page'] = $posts_per_page;
1146 - $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 );
1147 1160 }
1148 - $args = array_merge($default, $args);
1149 - $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 );
1150 1167 }
1151 1168
1152 1169 public function render_author() {
1153 1170
@@ -1168,13 +1185,12 @@
1168 1185
1169 1186 if (!$this->get_settings('show_comments')) {
1170 1187 return;
1171 1188 }
1172 - ?>
1189 + ?>
1173 1190
1174 1191 <div class="upk-fanel-comments">
1175 - <?php echo get_comments_number($id) ?>
1176 - <?php echo esc_html_x('Comments', 'Frontend', 'ultimate-post-kit') ?>
1192 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1177 1193 </div>
1178 1194
1179 1195 <?php
1180 1196 }
@@ -1222,9 +1238,9 @@
1222 1238 <?php if ($settings['show_author']) : ?>
1223 1239 <?php $this->render_author(); ?>
1224 1240 <?php endif; ?>
1225 1241 <?php if ($settings['show_comments']) : ?>
1226 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1242 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1227 1243 <?php $this->render_comments($post_id); ?>
1228 1244 </div>
1229 1245 <?php endif; ?>
1230 1246
@@ -1229,10 +1245,10 @@
1229 1245 <?php endif; ?>
1230 1246
1231 1247 <?php if (_is_upk_pro_activated()) :
1232 1248 if ('yes' === $settings['show_reading_time']) : ?>
1233 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1234 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1249 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
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' ) ); ?>
1235 1251 </div>
1236 1252 <?php endif; ?>
1237 1253 <?php endif; ?>
1238 1254 </div>
@@ -1311,8 +1327,10 @@
1311 1327 'show_comments' => isset($settings['show_comments']) ? $settings['show_comments'] : 'no',
1312 1328 'meta_separator' => isset($settings['meta_separator']) ? $settings['meta_separator'] : '//',
1313 1329 'show_reading_time' => isset($settings['show_reading_time']) ? $settings['show_reading_time'] : 'no',
1314 1330 'avg_reading_speed' => isset($settings['avg_reading_speed']) ? $settings['avg_reading_speed'] : 200,
1331 + 'hide_seconds' => isset($settings['hide_seconds']) ? $settings['hide_seconds'] : 'no',
1332 + 'hide_minutes' => isset($settings['hide_minutes']) ? $settings['hide_minutes'] : 'no',
1315 1333 'primary_thumbnail_size' => isset($settings['primary_thumbnail_size']) ? $settings['primary_thumbnail_size'] : 'medium',
1316 1334 'upk_link_new_tab' => isset($settings['upk_link_new_tab']) ? $settings['upk_link_new_tab'] : 'no',
1317 1335 'global_link' => isset($settings['global_link']) ? $settings['global_link'] : 'no',
1318 1336 ];