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/timeline/widgets/timeline.php +36 -17 4.1.2 → 4.5.6 View file →
@@ -150,9 +150,10 @@
150 150 [
151 151 'label' => esc_html__( 'Human Different Time', 'ultimate-post-kit' ),
152 152 'type' => Controls_Manager::SWITCHER,
153 153 'condition' => [
154 - 'show_inline_date' => 'yes'
154 + 'show_inline_date' => 'yes',
155 + 'show_date' => ''
155 156 ]
156 157 ]
157 158 );
158 159
@@ -175,9 +176,10 @@
175 176 'label' => esc_html__( 'Show Time', 'ultimate-post-kit' ),
176 177 'type' => Controls_Manager::SWITCHER,
177 178 'condition' => [
178 179 'human_diff_time' => '',
179 - 'show_inline_date' => 'yes'
180 + 'show_inline_date' => 'yes',
181 + 'show_date' => ''
180 182 ]
181 183 ]
182 184 );
183 185
@@ -212,8 +214,9 @@
212 214 $this->add_group_control(
213 215 Group_Control_Image_Size::get_type(),
214 216 [
215 217 'name' => 'primary_thumbnail',
218 + // phpcs:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude -- Elementor widget query built from user-configured controls; expected behaviour.
216 219 'exclude' => [ 'custom' ],
217 220 'default' => 'medium',
218 221 ]
219 222 );
@@ -261,8 +264,11 @@
261 264 ],
262 265 'default' => [
263 266 'size' => 6,
264 267 ],
268 + 'condition' => [
269 + 'posts_source!' => 'current_query',
270 + ]
265 271 ]
266 272 );
267 273
268 274 $this->register_query_builder_controls();
@@ -974,21 +980,33 @@
974 980 $this->register_pagination_controls();
975 981 }
976 982
977 983 /**
978 - * Main query render for this widget
979 - * @param $posts_per_page number item query limit
984 + * Get post query builder arguments
980 985 */
981 986 public function query_posts( $posts_per_page ) {
987 + $settings = $this->get_settings();
988 + $posts_per_page = isset( $posts_per_page ) ? (int) $posts_per_page : 0;
989 + $args = $this->getGroupControlQueryArgs();
990 + $is_current_query = ( ! empty( $settings['posts_source'] ) && $settings['posts_source'] === 'current_query' );
982 991
983 - $default = $this->getGroupControlQueryArgs();
984 - $args = [];
985 - if ( $posts_per_page ) {
992 + if ( $is_current_query ) {
993 + unset( $args['offset'] );
994 + unset( $args['no_found_rows'] );
995 + $posts_per_page = 0;
996 + }
997 +
998 + if ( $posts_per_page > 0 ) {
986 999 $args['posts_per_page'] = $posts_per_page;
987 - $args['paged'] = max( 1, get_query_var( 'paged' ), get_query_var( 'page' ) );
1000 + } else {
1001 + $args['posts_per_page'] = (int) get_option( 'posts_per_page', 10 );
988 1002 }
989 - $args = array_merge( $default, $args );
990 - $this->_query = new WP_Query( $args );
1003 +
1004 + if ( $settings['show_pagination'] ) {
1005 + $args['paged'] = max( 1, (int) get_query_var( 'paged' ), (int) get_query_var( 'page' ) );
1006 + }
1007 +
1008 + $this->_query = new \WP_Query( $args );
991 1009 }
992 1010
993 1011 public function render_author() {
994 1012
@@ -1012,10 +1030,9 @@
1012 1030 }
1013 1031 ?>
1014 1032
1015 1033 <div class="upk-comments">
1016 - <?php echo get_comments_number( $id ) ?>
1017 - <?php echo esc_html__( 'Comments', 'ultimate-post-kit' ) ?>
1034 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1018 1035 </div>
1019 1036
1020 1037 <?php
1021 1038 }
@@ -1029,9 +1046,9 @@
1029 1046
1030 1047 if ( $settings['human_diff_time'] == 'yes' ) {
1031 1048 echo esc_html( ultimate_post_kit_post_time_diff( ( $settings['human_diff_time_short'] == 'yes' ) ? 'short' : '' ) );
1032 1049 } else {
1033 - echo get_the_date();
1050 + echo esc_html( get_the_date() );
1034 1051 }
1035 1052 }
1036 1053
1037 1054 public function render_post_grid_item( $post_id, $image_size, $excerpt_length, $class ) {
@@ -1058,17 +1075,17 @@
1058 1075 <?php
1059 1076 $day_month_format = isset( $settings['day_month_format'] ) && ! empty( $settings['day_month_format'] ) ? $settings['day_month_format'] : 'm/d';
1060 1077 $year_format = isset( $settings['year_format'] ) && ! empty( $settings['year_format'] ) ? $settings['year_format'] : 'Y';
1061 1078 ?>
1062 - <span class="upk-month"><?php echo get_the_date( $day_month_format ); ?></span>
1063 - <span class="upk-year"><?php echo get_the_date( $year_format ); ?></span>
1079 + <span class="upk-month"><?php echo esc_html( get_the_date( $day_month_format ) ); ?></span>
1080 + <span class="upk-year"><?php echo esc_html( get_the_date( $year_format ) ); ?></span>
1064 1081 </div>
1065 1082 </div>
1066 1083 <?php else : ?>
1067 1084 <div class="upk-date-wrapper">
1068 1085 <div class="upk-date-inner">
1069 - <span class="upk-month"><?php echo get_the_date( 'm/d' ); ?></span>
1070 - <span class="upk-year"><?php echo get_the_date( 'Y' ); ?></span>
1086 + <span class="upk-month"><?php echo esc_html( get_the_date( 'm/d' ) ); ?></span>
1087 + <span class="upk-year"><?php echo esc_html( get_the_date( 'Y' ) ); ?></span>
1071 1088 </div>
1072 1089 </div>
1073 1090 <?php endif; ?>
1074 1091
@@ -1101,9 +1118,11 @@
1101 1118 <?php $this->render_excerpt( $excerpt_length ); ?>
1102 1119
1103 1120 <div class="upk-meta">
1104 1121 <?php $this->render_author(); ?>
1122 + <?php if( 'yes' === $settings['show_comments'] && 'yes' === $settings['show_author'] ) : ?>
1105 1123 <span class="upk-separator"><?php echo esc_html( $settings['meta_separator'] ); ?></span>
1124 + <?php endif; ?>
1106 1125 <?php $this->render_comments( $post_id ); ?>
1107 1126 </div>
1108 1127 </div>
1109 1128 </div>