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 +44 -24 4.1.1 → 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,21 +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 - $args = [];
1010 - 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 ) {
1011 1022 $args['posts_per_page'] = $posts_per_page;
1012 - $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 );
1013 1025 }
1014 - $args = array_merge($default, $args);
1015 - $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 );
1016 1032 }
1017 1033
1018 1034 protected function _upk_get_category($post_type) {
1019 1035 switch ($post_type) {
@@ -1054,13 +1070,16 @@
1054 1070 if (!$this->get_settings('show_title')) {
1055 1071 return;
1056 1072 }
1057 1073
1074 + $title = get_the_title();
1058 1075 printf(
1059 - '<%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>',
1060 - esc_attr(Utils::get_valid_html_tag($settings['title_tags'])),
1061 - esc_url( get_permalink() ), esc_html( get_the_title() ),
1062 - 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 )
1063 1082 );
1064 1083 }
1065 1084
1066 1085 public function render_date() {
@@ -1081,13 +1100,13 @@
1081 1100 <div class="upk-accordion-date">
1082 1101 <i class="upk-icon-calendar" aria-hidden="true"></i>
1083 1102 <span <?php
1084 1103 if($date_for_hover){
1085 - printf('data-hover="%s"', $date_for_hover);
1104 + printf('data-hover="%s"', esc_attr($date_for_hover));
1086 1105 }
1087 1106 ?>>
1088 1107 <?php
1089 - echo $date_for_hover;
1108 + echo esc_html($date_for_hover);
1090 1109 ?>
1091 1110 </span>
1092 1111 </div>
1093 1112 <?php if ($settings['show_time']) : ?>
@@ -1104,15 +1123,16 @@
1104 1123
1105 1124 if (!$this->get_settings('show_comments')) {
1106 1125 return;
1107 1126 }
1108 - ?>
1109 1127
1128 + $comment_text = $this->upk_get_formatted_comments_count( $id );
1129 + ?>
1130 +
1110 1131 <div class="upk-accordion-comments">
1111 1132 <i class="upk-icon-bubbles" aria-hidden="true"></i>
1112 - <span <?php printf('data-hover="%s"', get_comments_number($id) . ' ' . esc_html__('Comments', 'ultimate-post-kit')); ?>>
1113 - <?php echo get_comments_number($id); ?>
1114 - <?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); ?>
1115 1135 </span>
1116 1136 </div>
1117 1137
1118 1138 <?php
@@ -1137,9 +1157,9 @@
1137 1157 </div>
1138 1158 <div class="upk-author-role">
1139 1159 <?php
1140 1160 $aid = get_the_author_meta('ID');
1141 - echo ucwords(get_user_role($aid));
1161 + echo esc_html( get_user_role( $aid ) );
1142 1162 ?>
1143 1163 </div>
1144 1164 </div>
1145 1165 </div>
@@ -1175,9 +1195,9 @@
1175 1195 <div class="upk-accordion-meta">
1176 1196 <?php $this->render_date(); ?>
1177 1197
1178 1198 <?php if ($settings['show_comments'] == 'yes') : ?>
1179 - <div data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1199 + <div data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1180 1200 <?php $this->render_comments($post_id); ?>
1181 1201 </div>
1182 1202 <?php endif; ?>
1183 1203
@@ -1182,9 +1202,9 @@
1182 1202 <?php endif; ?>
1183 1203
1184 1204 <?php if (_is_upk_pro_activated()) :
1185 1205 if ('yes' === $settings['show_reading_time']) : ?>
1186 - <div class="upk-reading-time" data-separator="<?php echo esc_html($settings['meta_separator']); ?>">
1206 + <div class="upk-reading-time" data-separator="<?php echo esc_attr($settings['meta_separator']); ?>">
1187 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' ) ); ?>
1188 1208 </div>
1189 1209 <?php endif; ?>
1190 1210 <?php endif; ?>