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 +41 -19 4.0.9 → 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,20 +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 - 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 ) {
985 999 $args['posts_per_page'] = $posts_per_page;
986 - $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 );
987 1002 }
988 - $args = array_merge( $default, $args );
989 - $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 );
990 1009 }
991 1010
992 1011 public function render_author() {
993 1012
@@ -1011,10 +1030,9 @@
1011 1030 }
1012 1031 ?>
1013 1032
1014 1033 <div class="upk-comments">
1015 - <?php echo get_comments_number( $id ) ?>
1016 - <?php echo esc_html__( 'Comments', 'ultimate-post-kit' ) ?>
1034 + <?php echo esc_html( $this->upk_get_formatted_comments_count( $id ) ); ?>
1017 1035 </div>
1018 1036
1019 1037 <?php
1020 1038 }
@@ -1028,9 +1046,9 @@
1028 1046
1029 1047 if ( $settings['human_diff_time'] == 'yes' ) {
1030 1048 echo esc_html( ultimate_post_kit_post_time_diff( ( $settings['human_diff_time_short'] == 'yes' ) ? 'short' : '' ) );
1031 1049 } else {
1032 - echo get_the_date();
1050 + echo esc_html( get_the_date() );
1033 1051 }
1034 1052 }
1035 1053
1036 1054 public function render_post_grid_item( $post_id, $image_size, $excerpt_length, $class ) {
@@ -1057,25 +1075,27 @@
1057 1075 <?php
1058 1076 $day_month_format = isset( $settings['day_month_format'] ) && ! empty( $settings['day_month_format'] ) ? $settings['day_month_format'] : 'm/d';
1059 1077 $year_format = isset( $settings['year_format'] ) && ! empty( $settings['year_format'] ) ? $settings['year_format'] : 'Y';
1060 1078 ?>
1061 - <span class="upk-month"><?php echo get_the_date( $day_month_format ); ?></span>
1062 - <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>
1063 1081 </div>
1064 1082 </div>
1065 1083 <?php else : ?>
1066 1084 <div class="upk-date-wrapper">
1067 1085 <div class="upk-date-inner">
1068 - <span class="upk-month"><?php echo get_the_date( 'm/d' ); ?></span>
1069 - <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>
1070 1088 </div>
1071 1089 </div>
1072 1090 <?php endif; ?>
1073 1091
1074 1092 <div class="upk-image-and-content-wrapper">
1075 - <div class="upk-image-wrapper">
1076 - <?php $this->render_image( get_post_thumbnail_id( $post_id ), $image_size ); ?>
1077 - </div>
1093 + <?php if( 'yes' === $settings['show_image'] ) : ?>
1094 + <div class="upk-image-wrapper">
1095 + <?php $this->render_image( get_post_thumbnail_id( $post_id ), $image_size ); ?>
1096 + </div>
1097 + <?php endif; ?>
1078 1098 <div class="upk-content-wrap">
1079 1099
1080 1100 <?php $this->render_category(); ?>
1081 1101 <?php $this->render_title( substr( $this->get_name(), 4 ) ); ?>
@@ -1098,9 +1118,11 @@
1098 1118 <?php $this->render_excerpt( $excerpt_length ); ?>
1099 1119
1100 1120 <div class="upk-meta">
1101 1121 <?php $this->render_author(); ?>
1122 + <?php if( 'yes' === $settings['show_comments'] && 'yes' === $settings['show_author'] ) : ?>
1102 1123 <span class="upk-separator"><?php echo esc_html( $settings['meta_separator'] ); ?></span>
1124 + <?php endif; ?>
1103 1125 <?php $this->render_comments( $post_id ); ?>
1104 1126 </div>
1105 1127 </div>
1106 1128 </div>