Ultimate Posts Widget - Version 2.0.3

Version Description

  • Adds link to thumbnail images
  • Adds option to show all categories, tags, or types for better usability
  • Improve spacing and font sizes on some themes for the standard template
  • Document adding custom image sizes
  • Add option to display full size post thumbnail
  • Remove post_class() from legacy template for better backwards compatibility
Download this release

Release Info

Developer bostondv
Plugin Icon wp plugin Ultimate Posts Widget
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

css/upw-theme-standard.min.css CHANGED
@@ -1 +1 @@
1
- .upw-posts .hentry{display:block;margin-bottom:1.5rem;padding-bottom:1rem;border-bottom:1px solid #ddd}.upw-posts .hentry:last-child{border-bottom:0;padding-bottom:0}.upw-posts .entry-title{margin-bottom:.5rem}.upw-posts .entry-title a{text-decoration:none}.upw-posts .entry-title a:focus,.upw-posts .entry-title a:hover{text-decoration:underline}.upw-posts .entry-image{margin-bottom:1rem}.upw-posts .entry-image img{max-width:100%;height:auto}.upw-posts .entry-meta{color:#888;font-size:.9rem;margin-bottom:1rem;line-height:1.4}.upw-posts .entry-meta .comments{white-space:nowrap}.upw-posts .entry-content>:last-child,.upw-posts .entry-summary>:last-child{margin-bottom:1rem}.upw-posts .more-link{white-space:nowrap}.upw-posts footer{display:block;color:#888;font-size:.9rem;line-height:1.4}.upw-posts .custom-field,.upw-posts .entry-categories,.upw-posts .entry-custom-fields,.upw-posts .entry-tags{margin-bottom:.5rem}.upw-after,.upw-before{margin-bottom:1rem}.upw-after>:last-child,.upw-before>:last-child{margin-bottom:0}
1
+ .upw-posts article{display:block;margin-bottom:1.5em;padding-bottom:1em;border-bottom:1px solid #ddd}.upw-posts article:last-child{border-bottom:0;padding-bottom:0}.upw-posts .entry-title{margin-bottom:.5em}.upw-posts .entry-title a{text-decoration:none}.upw-posts .entry-title a:focus,.upw-posts .entry-title a:hover{text-decoration:underline}.upw-posts .entry-image{margin-bottom:1em}.upw-posts .entry-image img{max-width:100%;height:auto}.upw-posts .entry-meta{color:#888;font-size:.9em;margin-bottom:1em;line-height:1.4}.upw-posts .entry-meta .comments{white-space:nowrap}.upw-posts .entry-content>:last-child,.upw-posts .entry-summary>:last-child{margin-bottom:1em}.upw-posts .more-link{white-space:nowrap}.upw-posts footer{display:block;color:#888;font-size:.9em;line-height:1.4}.upw-posts .custom-field,.upw-posts .entry-categories,.upw-posts .entry-custom-fields,.upw-posts .entry-tags{margin-bottom:.5em}.upw-after,.upw-before{margin-bottom:1rem}.upw-after>:last-child,.upw-before>:last-child{margin-bottom:0}
package.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "bostondv/ultimate-posts-widget",
3
- "version": "2.0.2",
4
  "contributors": [
5
  "Boston Dell-Vandenberg <boston@pomelodesign.com>"
6
  ],
1
  {
2
  "name": "bostondv/ultimate-posts-widget",
3
+ "version": "2.0.3",
4
  "contributors": [
5
  "Boston Dell-Vandenberg <boston@pomelodesign.com>"
6
  ],
readme.txt CHANGED
@@ -4,9 +4,9 @@ Donate link: http://www.pomelodesign.com/donate/
4
  License: GPLv3
5
  License URI: http://www.gnu.org/licenses/gpl.html
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.6
8
  Tested up to: 4.0
9
- Stable tag: 2.0.2
10
 
11
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
 
@@ -62,33 +62,41 @@ Did you enjoy this plugin? Please [donate to support ongoing development](http:/
62
  = Filters =
63
 
64
  **upw_enqueue_styles** *(boolean)*
65
-
66
  Allows changing whether to load the template CSS file(s).
67
 
68
  **upw_wp_query_args** *(array)*
69
-
70
  Allows changing the WP_Query arguments for the widget.
71
 
72
  **upw_custom_template_path** *(string)*
73
-
74
  Allows changing the default custom template path.
75
 
76
  = Templates =
77
 
78
  **legacy**
79
-
80
  As of version 2.0.0 we changed the widget HTML markup. For installs prior to 2.0.0 you can use the legacy template to retain the old HTML markup and compatibility.
81
 
82
  **standard**
83
-
84
  The new standard template as of version 2.0.0. It features better HTML5 markup, improved styling on various themes without the need for custom CSS, and hfeed microformat.
85
 
86
  **custom**
87
-
88
  As of version 2.0.0 you can now provide your own custom template files. To do this, create a directory named `upw` in your theme and copy a template from the plugin's `templates` directory. Edit as needed.
89
 
90
  Then, in the widget settings under the *Display* tab, choose *Custom* from the *Template* drop down. In the *Custom Template Name* field that appears and enter the file name of your template (excluding .php). For example, if your template is named `custom.php` then enter `custom` in the *Custom Template Name* field.
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  = Thumbnail images are not displaying =
93
 
94
  *As of version 2.0.0 timthumb is no longer used.*
@@ -115,6 +123,14 @@ This plugin uses the [timthumb library](http://www.binarymoon.co.uk/projects/tim
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
 
 
118
  = 2.0.2 =
119
  * Reverts back to using `widget_title` filter
120
  * Fixes number of posts setting to allow unlimited amounts
4
  License: GPLv3
5
  License URI: http://www.gnu.org/licenses/gpl.html
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: 4.0
9
+ Stable tag: 2.0.3
10
 
11
  The ultimate widget for displaying posts, custom post types or sticky posts with an array of options.
12
 
62
  = Filters =
63
 
64
  **upw_enqueue_styles** *(boolean)*
 
65
  Allows changing whether to load the template CSS file(s).
66
 
67
  **upw_wp_query_args** *(array)*
 
68
  Allows changing the WP_Query arguments for the widget.
69
 
70
  **upw_custom_template_path** *(string)*
 
71
  Allows changing the default custom template path.
72
 
73
  = Templates =
74
 
75
  **legacy**
 
76
  As of version 2.0.0 we changed the widget HTML markup. For installs prior to 2.0.0 you can use the legacy template to retain the old HTML markup and compatibility.
77
 
78
  **standard**
 
79
  The new standard template as of version 2.0.0. It features better HTML5 markup, improved styling on various themes without the need for custom CSS, and hfeed microformat.
80
 
81
  **custom**
 
82
  As of version 2.0.0 you can now provide your own custom template files. To do this, create a directory named `upw` in your theme and copy a template from the plugin's `templates` directory. Edit as needed.
83
 
84
  Then, in the widget settings under the *Display* tab, choose *Custom* from the *Template* drop down. In the *Custom Template Name* field that appears and enter the file name of your template (excluding .php). For example, if your template is named `custom.php` then enter `custom` in the *Custom Template Name* field.
85
 
86
+ = Images sizes =
87
+
88
+ *As of version 2.0.0, the plugin no longer supports setting custom image sizes from the widget options panel.*
89
+
90
+ To change image sizes you can either edit the built-in sizes (thumbnail, medium, and large) or define a custom image size in your theme `functions.php`.
91
+
92
+ **Edit built-in image sizes:** Go to *Settings > Media* and change the image sizes as desired. Once image sizes are changed you will need to regenerate thumbnails to update any existing images. This can be done with [AJAX Thumbnail Rebuild](https://wordpress.org/plugins/ajax-thumbnail-rebuild/) or [Regenerate Thumbnails](https://wordpress.org/plugins/regenerate-thumbnails/) plugins. Note that this will affect image sizes for the entire site.
93
+
94
+ **Define a custom image size:** Edit your `functions.php` file and add a new image size with the `add_image_size` function. See the [WordPress codex for documentation](http://codex.wordpress.org/Function_Reference/add_image_size). Once the function is added, your custom size will be available to select from the widget options. Like editing a built-in size, you will need to regenerate thumbnails for existing images.
95
+
96
+ Example:
97
+
98
+ `<?php add_image_size( 'my-custom-size', 800, 600, false ); ?>`
99
+
100
  = Thumbnail images are not displaying =
101
 
102
  *As of version 2.0.0 timthumb is no longer used.*
123
 
124
  == Changelog ==
125
 
126
+ = 2.0.3 =
127
+ * Adds link to thumbnail images
128
+ * Adds option to show all categories, tags, or types for better usability
129
+ * Improve spacing and font sizes on some themes for the standard template
130
+ * Document adding custom image sizes
131
+ * Add option to display full size post thumbnail
132
+ * Remove post_class() from legacy template for better backwards compatibility
133
+
134
  = 2.0.2 =
135
  * Reverts back to using `widget_title` filter
136
  * Fixes number of posts setting to allow unlimited amounts
scss/upw-theme-standard.scss CHANGED
@@ -1,9 +1,9 @@
1
  .upw-posts {
2
 
3
- .hentry {
4
  display: block;
5
- margin-bottom: 1.5rem;
6
- padding-bottom: 1rem;
7
  border-bottom: 1px solid #ddd;
8
  &:last-child {
9
  border-bottom: 0;
@@ -12,7 +12,7 @@
12
  }
13
 
14
  .entry-title {
15
- margin-bottom: 0.5rem;
16
  a {
17
  text-decoration: none;
18
  &:hover,
@@ -23,7 +23,7 @@
23
  }
24
 
25
  .entry-image {
26
- margin-bottom: 1rem;
27
  img {
28
  max-width: 100%;
29
  height: auto;
@@ -32,8 +32,8 @@
32
 
33
  .entry-meta {
34
  color: #888;
35
- font-size: 0.9rem;
36
- margin-bottom: 1rem;
37
  line-height: 1.4;
38
  .comments {
39
  white-space: nowrap;
@@ -43,7 +43,7 @@
43
  .entry-summary,
44
  .entry-content {
45
  > :last-child {
46
- margin-bottom: 1rem;
47
  }
48
  }
49
 
@@ -54,18 +54,18 @@
54
  footer {
55
  display: block;
56
  color: #888;
57
- font-size: 0.9rem;
58
  line-height: 1.4;
59
  }
60
 
61
  .entry-categories,
62
  .entry-tags,
63
  .entry-custom-fields {
64
- margin-bottom: 0.5rem;
65
  }
66
 
67
  .custom-field {
68
- margin-bottom: 0.5rem;
69
  }
70
 
71
  }
1
  .upw-posts {
2
 
3
+ article {
4
  display: block;
5
+ margin-bottom: 1.5em;
6
+ padding-bottom: 1em;
7
  border-bottom: 1px solid #ddd;
8
  &:last-child {
9
  border-bottom: 0;
12
  }
13
 
14
  .entry-title {
15
+ margin-bottom: 0.5em;
16
  a {
17
  text-decoration: none;
18
  &:hover,
23
  }
24
 
25
  .entry-image {
26
+ margin-bottom: 1em;
27
  img {
28
  max-width: 100%;
29
  height: auto;
32
 
33
  .entry-meta {
34
  color: #888;
35
+ font-size: 0.9em;
36
+ margin-bottom: 1em;
37
  line-height: 1.4;
38
  .comments {
39
  white-space: nowrap;
43
  .entry-summary,
44
  .entry-content {
45
  > :last-child {
46
+ margin-bottom: 1em;
47
  }
48
  }
49
 
54
  footer {
55
  display: block;
56
  color: #888;
57
+ font-size: 0.9em;
58
  line-height: 1.4;
59
  }
60
 
61
  .entry-categories,
62
  .entry-tags,
63
  .entry-custom-fields {
64
+ margin-bottom: 0.5em;
65
  }
66
 
67
  .custom-field {
68
+ margin-bottom: 0.5em;
69
  }
70
 
71
  }
templates/legacy.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <?php if ($instance['before_posts']) : ?>
2
  <div class="upw-before">
3
  <?php echo wpautop($instance['before_posts']); ?>
@@ -12,7 +20,7 @@
12
 
13
  <?php $current_post = ($post->ID == $current_post_id && is_single()) ? 'current-post-item' : ''; ?>
14
 
15
- <li <?php post_class($current_post); ?>>
16
 
17
  <?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
18
  <div class="upw-image">
1
+ <?php
2
+ /**
3
+ * Legacy template for compatibility with versions prior to 2.0.0
4
+ *
5
+ * @version 2.0.0
6
+ */
7
+ ?>
8
+
9
  <?php if ($instance['before_posts']) : ?>
10
  <div class="upw-before">
11
  <?php echo wpautop($instance['before_posts']); ?>
20
 
21
  <?php $current_post = ($post->ID == $current_post_id && is_single()) ? 'current-post-item' : ''; ?>
22
 
23
+ <li class="<?php echo ($post->ID == $current_post_id && is_single())?'current-post-item':'' ?>">
24
 
25
  <?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
26
  <div class="upw-image">
templates/standard.php CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <?php if ($instance['before_posts']) : ?>
2
  <div class="upw-before">
3
  <?php echo wpautop($instance['before_posts']); ?>
@@ -18,7 +26,9 @@
18
 
19
  <?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
20
  <div class="entry-image">
21
- <?php the_post_thumbnail($instance['thumb_size']); ?>
 
 
22
  </div>
23
  <?php endif; ?>
24
 
1
+ <?php
2
+ /**
3
+ * Standard ultimate posts widget template
4
+ *
5
+ * @version 2.0.0
6
+ */
7
+ ?>
8
+
9
  <?php if ($instance['before_posts']) : ?>
10
  <div class="upw-before">
11
  <?php echo wpautop($instance['before_posts']); ?>
26
 
27
  <?php if (current_theme_supports('post-thumbnails') && $instance['show_thumbnail'] && has_post_thumbnail()) : ?>
28
  <div class="entry-image">
29
+ <a href="<?php the_permalink(); ?>" rel="bookmark">
30
+ <?php the_post_thumbnail($instance['thumb_size']); ?>
31
+ </a>
32
  </div>
33
  <?php endif; ?>
34
 
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.2
7
  Author: Boston Dell-Vandenberg
8
  Author URI: http://pomelodesign.com
9
  Text Domain: upw
@@ -99,7 +99,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
99
  $title_link = $instance['title_link'];
100
  $class = $instance['class'];
101
  $number = empty($instance['number']) ? -1 : $instance['number'];
102
- $types = empty($instance['types']) ? '' : explode(',', $instance['types']);
103
  $cats = empty($instance['cats']) ? '' : explode(',', $instance['cats']);
104
  $tags = empty($instance['tags']) ? '' : explode(',', $instance['tags']);
105
  $atcat = $instance['atcat'] ? true : false;
@@ -348,10 +348,10 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
348
  $before_posts = format_to_edit($instance['before_posts']);
349
  $after_posts = format_to_edit($instance['after_posts']);
350
 
351
- // Let's turn $types, $cats, and $tags into an array
352
- $types = explode(',', $types);
353
- $cats = explode(',', $cats);
354
- $tags = explode(',', $tags);
355
 
356
  // Count number of post types for select box sizing
357
  $cpt_types = get_post_types( array( 'public' => true ), 'names' );
@@ -514,6 +514,7 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
514
  <?php foreach ($sizes as $size) : ?>
515
  <option value="<?php echo $size; ?>"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php echo $size; ?></option>
516
  <?php endforeach; ?>
 
517
  </select>
518
  </p>
519
 
@@ -546,10 +547,11 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
546
  <p>
547
  <label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Categories', 'upw' ); ?>:</label>
548
  <select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
 
549
  <?php
550
  $categories = get_categories( 'hide_empty=0' );
551
  foreach ($categories as $category ) { ?>
552
- <option value="<?php echo $category->term_id; ?>" <?php if( in_array($category->term_id, $cats)) { echo 'selected="selected"'; } ?>><?php echo $category->cat_name;?></option>
553
  <?php } ?>
554
  </select>
555
  </p>
@@ -563,9 +565,10 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
563
  <p>
564
  <label for="<?php echo $this->get_field_id('tags'); ?>"><?php _e( 'Tags', 'upw' ); ?>:</label>
565
  <select name="<?php echo $this->get_field_name('tags'); ?>[]" id="<?php echo $this->get_field_id('tags'); ?>" class="widefat" style="height: auto;" size="<?php echo $t ?>" multiple>
 
566
  <?php
567
  foreach ($tag_list as $tag) { ?>
568
- <option value="<?php echo $tag->term_id; ?>" <?php if( in_array($tag->term_id, $tags)) { echo 'selected="selected"'; } ?>><?php echo $tag->name;?></option>
569
  <?php } ?>
570
  </select>
571
  </p>
@@ -574,11 +577,12 @@ if ( !class_exists( 'WP_Widget_Ultimate_Posts' ) ) {
574
  <p>
575
  <label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Post types', 'upw' ); ?>:</label>
576
  <select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
 
577
  <?php
578
  $args = array( 'public' => true );
579
  $post_types = get_post_types( $args, 'names' );
580
  foreach ($post_types as $post_type ) { ?>
581
- <option value="<?php echo $post_type; ?>" <?php if( in_array($post_type, $types)) { echo 'selected="selected"'; } ?>><?php echo $post_type;?></option>
582
  <?php } ?>
583
  </select>
584
  </p>
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.3
7
  Author: Boston Dell-Vandenberg
8
  Author URI: http://pomelodesign.com
9
  Text Domain: upw
99
  $title_link = $instance['title_link'];
100
  $class = $instance['class'];
101
  $number = empty($instance['number']) ? -1 : $instance['number'];
102
+ $types = empty($instance['types']) ? 'any' : explode(',', $instance['types']);
103
  $cats = empty($instance['cats']) ? '' : explode(',', $instance['cats']);
104
  $tags = empty($instance['tags']) ? '' : explode(',', $instance['tags']);
105
  $atcat = $instance['atcat'] ? true : false;
348
  $before_posts = format_to_edit($instance['before_posts']);
349
  $after_posts = format_to_edit($instance['after_posts']);
350
 
351
+ // Let's turn $types, $cats, and $tags into an array if they are set
352
+ if (!empty($types)) $types = explode(',', $types);
353
+ if (!empty($cats)) $cats = explode(',', $cats);
354
+ if (!empty($tags)) $tags = explode(',', $tags);
355
 
356
  // Count number of post types for select box sizing
357
  $cpt_types = get_post_types( array( 'public' => true ), 'names' );
514
  <?php foreach ($sizes as $size) : ?>
515
  <option value="<?php echo $size; ?>"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php echo $size; ?></option>
516
  <?php endforeach; ?>
517
+ <option value="full"<?php if ($thumb_size == $size) echo ' selected'; ?>><?php _e('full'); ?></option>
518
  </select>
519
  </p>
520
 
547
  <p>
548
  <label for="<?php echo $this->get_field_id('cats'); ?>"><?php _e( 'Categories', 'upw' ); ?>:</label>
549
  <select name="<?php echo $this->get_field_name('cats'); ?>[]" id="<?php echo $this->get_field_id('cats'); ?>" class="widefat" style="height: auto;" size="<?php echo $c ?>" multiple>
550
+ <option value="" <?php if (empty($cats)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
551
  <?php
552
  $categories = get_categories( 'hide_empty=0' );
553
  foreach ($categories as $category ) { ?>
554
+ <option value="<?php echo $category->term_id; ?>" <?php if(is_array($cats) && in_array($category->term_id, $cats)) echo 'selected="selected"'; ?>><?php echo $category->cat_name;?></option>
555
  <?php } ?>
556
  </select>
557
  </p>
565
  <p>
566
  <label for="<?php echo $this->get_field_id('tags'); ?>"><?php _e( 'Tags', 'upw' ); ?>:</label>
567
  <select name="<?php echo $this->get_field_name('tags'); ?>[]" id="<?php echo $this->get_field_id('tags'); ?>" class="widefat" style="height: auto;" size="<?php echo $t ?>" multiple>
568
+ <option value="" <?php if (empty($tags)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
569
  <?php
570
  foreach ($tag_list as $tag) { ?>
571
+ <option value="<?php echo $tag->term_id; ?>" <?php if (is_array($tags) && in_array($tag->term_id, $tags)) echo 'selected="selected"'; ?>><?php echo $tag->name;?></option>
572
  <?php } ?>
573
  </select>
574
  </p>
577
  <p>
578
  <label for="<?php echo $this->get_field_id('types'); ?>"><?php _e( 'Post types', 'upw' ); ?>:</label>
579
  <select name="<?php echo $this->get_field_name('types'); ?>[]" id="<?php echo $this->get_field_id('types'); ?>" class="widefat" style="height: auto;" size="<?php echo $n ?>" multiple>
580
+ <option value="" <?php if (empty($types)) echo 'selected="selected"'; ?>><?php _e('&ndash; Show All &ndash;') ?></option>
581
  <?php
582
  $args = array( 'public' => true );
583
  $post_types = get_post_types( $args, 'names' );
584
  foreach ($post_types as $post_type ) { ?>
585
+ <option value="<?php echo $post_type; ?>" <?php if(is_array($types) && in_array($post_type, $types)) { echo 'selected="selected"'; } ?>><?php echo $post_type;?></option>
586
  <?php } ?>
587
  </select>
588
  </p>