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/post-accordion/widgets/post-accordion.php +45 -24 4.0.9 → 4.5.6 View file →
@@ -155,8 +155,9 @@
155 155 $this->add_group_control(
156 156 Group_Control_Image_Size::get_type(),
157 157 [
158 158 'name' => 'primary_thumbnail',
159 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
159 160 'exclude' => ['custom'],
160 161 'default' => 'large',
161 162 ]
162 163 );
@@ -185,8 +186,11 @@
185 186 ],
186 187 'default' => [
187 188 'size' => 3,
188 189 ],
190 + 'condition' => [
191 + 'posts_source!' => 'current_query',
192 + ]
189 193 ]
190 194 );
191 195
192 196 $this->register_query_builder_controls();
@@ -195,9 +199,9 @@
195 199
196 200 $this->start_controls_section(
197 201 'section_content_additional',
198 202 [
199 - 'label' => esc_html__('Additional', 'ultimate-post-kit'),
203 + 'label' => esc_html__('Additional Options', 'ultimate-post-kit'),
200 204 ]
201 205 );
202 206
203 207 //Global Title Controls
@@ -380,9 +384,9 @@
380 384 [
381 385 'label' => esc_html__('Glassmorphism', 'ultimate-post-kit'),
382 386 'type' => Controls_Manager::SWITCHER,
383 387 // translators: %1s: Opening anchor tag with link to MDN backdrop-filter documentation, %2s: Closing anchor tag
384 - '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>'),
388 + '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>'),
385 389 ]
386 390 );
387 391
388 392 $this->add_control(
@@ -999,20 +1003,33 @@
999 1003 $this->register_pagination_controls();
1000 1004 }
1001 1005
1002 1006 /**
1003 - * Main query render for this widget
1004 - * @param $posts_per_page number item query limit
1007 + * Get post query builder arguments
1005 1008 */
1006 - public function query_posts($posts_per_page) {
1009 + public function query_posts( $posts_per_page ) {
1010 + $settings = $this->get_settings();
1011 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
1012 + $args = $this->getGroupControlQueryArgs();
1013 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
1007 1014
1008 - $default = $this->getGroupControlQueryArgs();
1009 - if ($posts_per_page) {
1015 + if ( $is_current_query ) {
1016 + unset( $args['offset'] );
1017 + unset( $args['no_found_rows'] );
1018 + $posts_per_page = 0;
1019 + }
1020 +
1021 + if ( $posts_per_page > 0 ) {
1010 1022 $args['posts_per_page'] = $posts_per_page;
1011 - $args['paged'] = max(1, get_query_var('paged'), get_query_var('page'));
1023 + } else {
1024 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
1012 1025 }
1013 - $args = array_merge($default, $args);
1014 - $this->_query = new WP_Query($args);
1026 +
1027 + if ( $settings['show_pagination'] ) {
1028 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1029 + }
1030 +
1031 + $this->_query = new \WP_Query( $args );
1015 1032 }
1016 1033
1017 1034 protected function _upk_get_category($post_type) {
1018 1035 switch ($post_type) {
@@ -1053,13 +1070,16 @@
1053 1070 if (!$this->get_settings('show_title')) {
1054 1071 return;
1055 1072 }
1056 1073
1074 + $title = get_the_title();
1057 1075 printf(
1058 - '<%1$s class="upk-title"><a data-hover="%3$s" href="%2$s" title="%3$s" class="title-animation-%4$s">%3$s</a></%1$s>',
1059 - esc_attr(Utils::get_valid_html_tag($settings['title_tags'])),
1060 - esc_url( get_permalink() ), esc_html( get_the_title() ),
1061 - esc_attr($settings['title_style'])
1076 + '<%1$s class="upk-title"><a data-hover="%5$s" href="%2$s" title="%5$s" class="title-animation-%4$s">%3$s</a></%1$s>',
1077 + esc_attr(Utils::get_valid_html_tag($settings['title_tags'])),
1078 + esc_url( get_permalink() ),
1079 + esc_html( $title ),
1080 + esc_attr($settings['title_style']),
1081 + esc_attr( $title )
1062 1082 );
1063 1083 }
1064 1084
1065 1085 public function render_date() {
@@ -1080,13 +1100,13 @@
1080 1100 <div class="upk-accordion-date">
1081 1101 <i class="upk-icon-calendar" aria-hidden="true"></i>
1082 1102 <span <?php
1083 1103 if($date_for_hover){
1084 - printf('data-hover="%s"', $date_for_hover);
1104 + printf('data-hover="%s"', esc_attr($date_for_hover));
1085 1105 }
1086 1106 ?>>
1087 1107 <?php
1088 - echo $date_for_hover;
1108 + echo esc_html($date_for_hover);
1089 1109 ?>
1090 1110 </span>
1091 1111 </div>
1092 1112 <?php if ($settings['show_time']) : ?>
@@ -1103,15 +1123,16 @@
1103 1123
1104 1124 if (!$this->get_settings('show_comments')) {
1105 1125 return;
1106 1126 }
1107 - ?>
1108 1127
1128 + $comment_text = $this->upk_get_formatted_comments_count( $id );
1129 + ?>
1130 +
1109 1131 <div class="upk-accordion-comments">
1110 1132 <i class="upk-icon-bubbles" aria-hidden="true"></i>
1111 - <span <?php printf('data-hover="%s"', get_comments_number($id) . ' ' . esc_html__('Comments', 'ultimate-post-kit')); ?>>
1112 - <?php echo get_comments_number($id); ?>
1113 - <?php echo esc_html__('Comments', 'ultimate-post-kit'); ?>
1133 + <span <?php printf('data-hover="%s"', esc_attr($comment_text)); ?>>
1134 + <?php echo esc_html($comment_text); ?>
1114 1135 </span>
1115 1136 </div>
1116 1137
1117 1138 <?php
@@ -1136,9 +1157,9 @@
1136 1157 </div>
1137 1158 <div class="upk-author-role">
1138 1159 <?php
1139 1160 $aid = get_the_author_meta('ID');
1140 - echo ucwords(get_user_role($aid));
1161 + echo esc_html( get_user_role( $aid ) );
1141 1162 ?>
1142 1163 </div>
1143 1164 </div>
1144 1165 </div>
@@ -1174,9 +1195,9 @@
1174 1195 <div class="upk-accordion-meta">
1175 1196 <?php $this->render_date(); ?>
1176 1197
1177 1198 <?php if ($settings['show_comments'] == 'yes') : ?>
1178 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1199 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1179 1200 <?php $this->render_comments($post_id); ?>
1180 1201 </div>
1181 1202 <?php endif; ?>
1182 1203
@@ -1181,10 +1202,10 @@
1181 1202 <?php endif; ?>
1182 1203
1183 1204 <?php if (_is_upk_pro_activated()) :
1184 1205 if ('yes' === $settings['show_reading_time']) : ?>
1185 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1186 - <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'] ) ); ?>
1206 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1207 + <?php echo esc_html( ultimate_post_kit_reading_time( get_the_content(), $settings['avg_reading_speed'], $settings['hide_seconds'] ?? 'no', $settings['hide_minutes'] ?? 'no' ) ); ?>
1187 1208 </div>
1188 1209 <?php endif; ?>
1189 1210 <?php endif; ?>
1190 1211 </div>