Ultimate Posts Widget - Version 2.1.0

Version Description

  • Added possibility for changing custom message when no posts.
  • Increased stability of the plugin
  • Fixed filtering
  • Tested update WordPress 5.3.2+
Download this release

Release Info

Developer cl272
Plugin Icon wp plugin Ultimate Posts Widget
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.9 to 2.1.0

.gitignore CHANGED
@@ -2,3 +2,4 @@
2
  node_modules
3
  .sass-cache
4
  *.tmp
 
2
  node_modules
3
  .sass-cache
4
  *.tmp
5
+ package-lock.json
gulpfile.js CHANGED
@@ -1,5 +1,5 @@
1
  var gulp = require('gulp');
2
- var sass = require('gulp-ruby-sass');
3
  var prefix = require('gulp-autoprefixer');
4
  var minify = require('gulp-minify-css');
5
  var rename = require('gulp-rename');
@@ -8,10 +8,9 @@ var size = require('gulp-size');
8
  var uglify = require('gulp-uglifyjs');
9
 
10
  gulp.task('styles', function () {
11
- return gulp.src([
12
- 'scss/*.scss'
13
- ])
14
  .pipe(sass({
 
15
  precision: 10
16
  }))
17
  .pipe(prefix('last 2 versions', 'ie 8'))
@@ -22,7 +21,7 @@ gulp.task('styles', function () {
22
  title: 'Styles'
23
  }))
24
  .pipe(rename({suffix: '.min'}))
25
- .pipe(gulp.dest('css'));
26
  });
27
 
28
  gulp.task('scripts', function() {
@@ -37,13 +36,13 @@ gulp.task('scripts', function() {
37
  title: 'Scripts'
38
  }))
39
  .pipe(rename({suffix: '.min'}))
40
- .pipe(gulp.dest('js'));
41
 
42
  });
43
 
44
  gulp.task('watch', function () {
45
- gulp.watch('scss/**/*.scss', ['styles']);
46
- gulp.watch('js/**/*.js', ['scripts']);
47
  });
48
 
49
- gulp.task('default', ['styles', 'scripts']);
1
  var gulp = require('gulp');
2
+ var sass = require('gulp-sass');
3
  var prefix = require('gulp-autoprefixer');
4
  var minify = require('gulp-minify-css');
5
  var rename = require('gulp-rename');
8
  var uglify = require('gulp-uglifyjs');
9
 
10
  gulp.task('styles', function () {
11
+ return gulp.src([`${__dirname}/scss/*.scss`])
 
 
12
  .pipe(sass({
13
+ outputStyle: 'compressed',
14
  precision: 10
15
  }))
16
  .pipe(prefix('last 2 versions', 'ie 8'))
21
  title: 'Styles'
22
  }))
23
  .pipe(rename({suffix: '.min'}))
24
+ .pipe(gulp.dest(`${__dirname}/css/`));
25
  });
26
 
27
  gulp.task('scripts', function() {
36
  title: 'Scripts'
37
  }))
38
  .pipe(rename({suffix: '.min'}))
39
+ .pipe(gulp.dest(`${__dirname}/js`));
40
 
41
  });
42
 
43
  gulp.task('watch', function () {
44
+ gulp.watch('scss/**/*.scss', gulp.series('styles'));
45
+ gulp.watch('js/**/*.js', gulp.series('scripts'));
46
  });
47
 
48
+ gulp.task('default', gulp.parallel(['styles', 'scripts']));
package.json CHANGED
@@ -22,13 +22,13 @@
22
  "node": ">= 0.10.0"
23
  },
24
  "devDependencies": {
25
- "gulp": "^3.8.6",
26
- "gulp-autoprefixer": "^0.0.8",
27
- "gulp-minify-css": "^0.3.7",
28
- "gulp-rename": "^1.2.0",
29
- "gulp-ruby-sass": "^0.7.1",
30
- "gulp-size": "^1.0.0",
31
- "gulp-uglifyjs": "^0.4.2",
32
- "gulp-util": "^3.0.0"
33
  }
34
  }
22
  "node": ">= 0.10.0"
23
  },
24
  "devDependencies": {
25
+ "gulp": "^4.0.2",
26
+ "gulp-autoprefixer": "^7.0.1",
27
+ "gulp-minify-css": "^1.2.4",
28
+ "gulp-rename": "^2.0.0",
29
+ "gulp-size": "^3.0.0",
30
+ "gulp-uglifyjs": "^0.6.2",
31
+ "gulp-util": "^3.0.8",
32
+ "gulp-sass": "^4.0.2"
33
  }
34
  }
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === Ultimate Posts Widget ===
2
- Contributors: cl272
3
  Donate link: https://sellcodes.com/5U4SICyc
4
  License: MIT
5
  License URI: http://opensource.org/licenses/MIT
6
  Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category, custom fields, list pages, widget query, microformats, customizable widget, categories widget, tags widget, excerpt, widget templates, post author, post date, custom query, ultimate posts, comments, orderby, comment count
7
  Requires at least: 3.5
8
  Tested up to: 5.3
9
- Stable tag: 2.0.9
10
 
11
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
 
13
  == Description ==
14
 
15
- UPDATE: Plugin ownership changed for this plugin. We are currently evaluating possible enhancements for it. Stay tuned! If you have any suggestions yourself, please let us know in the Support Forum.
16
 
17
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options to customize the display.
18
 
@@ -119,6 +119,12 @@ This plugin uses the [timthumb library](http://www.binarymoon.co.uk/projects/tim
119
 
120
  == Changelog ==
121
 
 
 
 
 
 
 
122
  = 2.0.9 =
123
  * Replaced deprecated code
124
 
@@ -261,9 +267,9 @@ This plugin uses the [timthumb library](http://www.binarymoon.co.uk/projects/tim
261
 
262
  == Upgrade Notice ==
263
 
264
- = 2.0.9 =
265
 
266
- Please upgrade
267
 
268
  == Installation ==
269
 
1
  === Ultimate Posts Widget ===
2
+ Contributors: cl272, upwsupport
3
  Donate link: https://sellcodes.com/5U4SICyc
4
  License: MIT
5
  License URI: http://opensource.org/licenses/MIT
6
  Tags: widget, recent posts, custom post types, sticky posts, featured image, post thumbnail, excerpts, category, custom fields, list pages, widget query, microformats, customizable widget, categories widget, tags widget, excerpt, widget templates, post author, post date, custom query, ultimate posts, comments, orderby, comment count
7
  Requires at least: 3.5
8
  Tested up to: 5.3
9
+ Stable tag: 2.1.0
10
 
11
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
 
13
  == Description ==
14
 
15
+ UPDATE: Plugin ownership changed for this plugin. We are currently evaluating possible enhancements for it. Stay tuned! If you have any suggestions yourself, please let us know in the Support Forum.
16
 
17
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options to customize the display.
18
 
119
 
120
  == Changelog ==
121
 
122
+ = 2.1.0 =
123
+ * Added possibility for changing custom message when no posts.
124
+ * Increased stability of the plugin
125
+ * Fixed filtering
126
+ * Tested update WordPress 5.3.2+
127
+
128
  = 2.0.9 =
129
  * Replaced deprecated code
130
 
267
 
268
  == Upgrade Notice ==
269
 
270
+ = 2.1.0 =
271
 
272
+ Please update
273
 
274
  == Installation ==
275
 
templates/legacy.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Legacy template for compatibility with versions prior to 2.0.0
4
  *
5
- * @version 2.0.0
6
  */
7
  ?>
8
 
@@ -95,7 +95,7 @@
95
 
96
  <?php if ($custom_fields) {
97
  $custom_field_name = explode(',', $custom_fields);
98
- foreach ($custom_field_name as $name) {
99
  $name = trim($name);
100
  $custom_field_values = get_post_meta($post->ID, $name, true);
101
  if ($custom_field_values) {
@@ -111,7 +111,7 @@
111
  }
112
  echo '</p>';
113
  }
114
- }
115
  } ?>
116
 
117
  </div>
@@ -119,12 +119,12 @@
119
  </li>
120
 
121
  <?php endwhile; ?>
122
-
123
  </ul>
124
 
125
  <?php else : ?>
126
 
127
- <p><?php _e('No posts found.', 'upw'); ?></p>
128
 
129
  <?php endif; ?>
130
 
@@ -132,4 +132,4 @@
132
  <div class="upw-after">
133
  <?php echo wpautop($instance['after_posts']); ?>
134
  </div>
135
- <?php endif; ?>
2
  /**
3
  * Legacy template for compatibility with versions prior to 2.0.0
4
  *
5
+ * @version 2.1.1
6
  */
7
  ?>
8
 
95
 
96
  <?php if ($custom_fields) {
97
  $custom_field_name = explode(',', $custom_fields);
98
+ foreach ($custom_field_name as $name) {
99
  $name = trim($name);
100
  $custom_field_values = get_post_meta($post->ID, $name, true);
101
  if ($custom_field_values) {
111
  }
112
  echo '</p>';
113
  }
114
+ }
115
  } ?>
116
 
117
  </div>
119
  </li>
120
 
121
  <?php endwhile; ?>
122
+
123
  </ul>
124
 
125
  <?php else : ?>
126
 
127
+ <p><?php echo wpautop($instance['custom_empty']); ?></p>
128
 
129
  <?php endif; ?>
130
 
132
  <div class="upw-after">
133
  <?php echo wpautop($instance['after_posts']); ?>
134
  </div>
135
+ <?php endif; ?>
templates/standard.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Standard ultimate posts widget template
4
  *
5
- * @version 2.0.0
6
  */
7
  ?>
8
 
@@ -148,7 +148,7 @@
148
  <?php else : ?>
149
 
150
  <p class="upw-not-found">
151
- <?php _e('No posts found.', 'upw'); ?>
152
  </p>
153
 
154
  <?php endif; ?>
@@ -159,4 +159,4 @@
159
  <div class="upw-after">
160
  <?php echo wpautop($instance['after_posts']); ?>
161
  </div>
162
- <?php endif; ?>
2
  /**
3
  * Standard ultimate posts widget template
4
  *
5
+ * @version 2.1.1
6
  */
7
  ?>
8
 
148
  <?php else : ?>
149
 
150
  <p class="upw-not-found">
151
+ <?php echo wpautop($instance['custom_empty']); ?>
152
  </p>
153
 
154
  <?php endif; ?>
159
  <div class="upw-after">
160
  <?php echo wpautop($instance['after_posts']); ?>
161
  </div>
162
+ <?php endif; ?>
ultimate-posts-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ultimate Posts Widget
4
  Plugin URI: http://wordpress.org/plugins/ultimate-posts-widget/
5
  Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
6
- Version: 2.0.9
7
  Author: Clever Widgets
8
  Author URI: https://themecheck.info
9
  Text Domain: upw
@@ -93,7 +93,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
93
  extract( $args );
94
 
95
  $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
96
- $title_link = $instance['title_link'];
97
  $class = $instance['class'];
98
  $number = empty($instance['number']) ? -1 : $instance['number'];
99
  $types = empty($instance['types']) ? 'any' : explode(',', $instance['types']);
@@ -108,8 +108,15 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
108
  $order = $instance['order'];
109
  $orderby = $instance['orderby'];
110
  $meta_key = $instance['meta_key'];
 
111
  $custom_fields = $instance['custom_fields'];
112
 
 
 
 
 
 
 
113
  // Sticky posts
114
  if ($sticky == 'only') {
115
  $sticky_query = array( 'post__in' => get_option( 'sticky_posts' ) );
@@ -161,7 +168,6 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
161
  return $excerpt_length;
162
  };
163
  if ( $instance['excerpt_length'] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
164
-
165
  if( $class ) {
166
  $before_widget = str_replace('class="', 'class="'. $class . ' ', $before_widget);
167
  }
@@ -182,7 +188,8 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
182
  'orderby' => $orderby,
183
  'category__in' => $cats,
184
  'tag__in' => $tags,
185
- 'post_type' => $types
 
186
  );
187
 
188
  if ($orderby === 'meta_value') {
@@ -219,6 +226,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
219
  $cache[$args['widget_id']] = ob_get_flush();
220
  }
221
  wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
 
 
 
 
 
222
  }
223
 
224
  function update( $new_instance, $old_instance ) {
@@ -253,6 +265,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
253
  $instance['show_tags'] = isset( $new_instance['show_tags'] );
254
  $instance['custom_fields'] = strip_tags( $new_instance['custom_fields'] );
255
  $instance['template'] = strip_tags( $new_instance['template'] );
 
256
  $instance['template_custom'] = strip_tags( $new_instance['template_custom'] );
257
 
258
  if (current_user_can('unfiltered_html')) {
@@ -310,6 +323,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
310
  'show_content' => false,
311
  'show_readmore' => true,
312
  'show_thumbnail' => true,
 
313
  'custom_fields' => '',
314
  // Set template to 'legacy' if field from UPW < 2.0 is set.
315
  'template' => empty($instance['morebutton_text']) ? 'standard' : 'legacy',
@@ -346,6 +360,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
346
  $show_content = $instance['show_content'];
347
  $show_readmore = $instance['show_readmore'];
348
  $show_thumbnail = $instance['show_thumbnail'];
 
349
  $custom_fields = strip_tags($instance['custom_fields']);
350
  $template = $instance['template'];
351
  $template_custom = strip_tags($instance['template_custom']);
@@ -429,6 +444,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
429
  <textarea class="widefat" id="<?php echo $this->get_field_id('after_posts'); ?>" name="<?php echo $this->get_field_name('after_posts'); ?>" rows="5"><?php echo $after_posts; ?></textarea>
430
  </p>
431
 
 
 
 
 
 
432
  </div>
433
 
434
  <div class="upw-tab upw-hide upw-tab-display">
3
  Plugin Name: Ultimate Posts Widget
4
  Plugin URI: http://wordpress.org/plugins/ultimate-posts-widget/
5
  Description: The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
6
+ Version: 2.1.0
7
  Author: Clever Widgets
8
  Author URI: https://themecheck.info
9
  Text Domain: upw
93
  extract( $args );
94
 
95
  $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
96
+ $title_link = $instance['title_link'];
97
  $class = $instance['class'];
98
  $number = empty($instance['number']) ? -1 : $instance['number'];
99
  $types = empty($instance['types']) ? 'any' : explode(',', $instance['types']);
108
  $order = $instance['order'];
109
  $orderby = $instance['orderby'];
110
  $meta_key = $instance['meta_key'];
111
+ $custom_empty = isset($instance['custom_empty']) ? $instance['custom_empty'] : '';
112
  $custom_fields = $instance['custom_fields'];
113
 
114
+ if (strlen($custom_empty) == 0) {
115
+ $custom_empty = 'No posts found.';
116
+ $instance['custom_empty'] = 'No posts found.';
117
+ }
118
+
119
+
120
  // Sticky posts
121
  if ($sticky == 'only') {
122
  $sticky_query = array( 'post__in' => get_option( 'sticky_posts' ) );
168
  return $excerpt_length;
169
  };
170
  if ( $instance['excerpt_length'] > 0 ) add_filter('excerpt_length', $new_excerpt_length);
 
171
  if( $class ) {
172
  $before_widget = str_replace('class="', 'class="'. $class . ' ', $before_widget);
173
  }
188
  'orderby' => $orderby,
189
  'category__in' => $cats,
190
  'tag__in' => $tags,
191
+ 'post_type' => $types,
192
+ 'post_status' => array('publish', 'inherit')
193
  );
194
 
195
  if ($orderby === 'meta_value') {
226
  $cache[$args['widget_id']] = ob_get_flush();
227
  }
228
  wp_cache_set( 'widget_ultimate_posts', $cache, 'widget' );
229
+
230
+ remove_filter('excerpt_more', $new_excerpt_more);
231
+ if ( $instance['excerpt_length'] > 0 ) remove_filter('excerpt_length', $new_excerpt_length);
232
+
233
+ ob_end_flush();
234
  }
235
 
236
  function update( $new_instance, $old_instance ) {
265
  $instance['show_tags'] = isset( $new_instance['show_tags'] );
266
  $instance['custom_fields'] = strip_tags( $new_instance['custom_fields'] );
267
  $instance['template'] = strip_tags( $new_instance['template'] );
268
+ $instance['custom_empty'] = strip_tags( $new_instance['custom_empty'] );
269
  $instance['template_custom'] = strip_tags( $new_instance['template_custom'] );
270
 
271
  if (current_user_can('unfiltered_html')) {
323
  'show_content' => false,
324
  'show_readmore' => true,
325
  'show_thumbnail' => true,
326
+ 'custom_empty' => 'No posts found.',
327
  'custom_fields' => '',
328
  // Set template to 'legacy' if field from UPW < 2.0 is set.
329
  'template' => empty($instance['morebutton_text']) ? 'standard' : 'legacy',
360
  $show_content = $instance['show_content'];
361
  $show_readmore = $instance['show_readmore'];
362
  $show_thumbnail = $instance['show_thumbnail'];
363
+ $custom_empty = strip_tags($instance['custom_empty']);
364
  $custom_fields = strip_tags($instance['custom_fields']);
365
  $template = $instance['template'];
366
  $template_custom = strip_tags($instance['template_custom']);
444
  <textarea class="widefat" id="<?php echo $this->get_field_id('after_posts'); ?>" name="<?php echo $this->get_field_name('after_posts'); ?>" rows="5"><?php echo $after_posts; ?></textarea>
445
  </p>
446
 
447
+ <p>
448
+ <label for="<?php echo $this->get_field_id( 'custom_empty' ); ?>"><?php _e( 'No posts found message', 'upw' ); ?>:</label>
449
+ <input class="widefat" id="<?php echo $this->get_field_id( 'custom_empty' ); ?>" name="<?php echo $this->get_field_name( 'custom_empty' ); ?>" type="text" value="<?php echo $custom_empty; ?>" placeholder="No posts found." />
450
+ </p>
451
+
452
  </div>
453
 
454
  <div class="upw-tab upw-hide upw-tab-display">