Flexible Posts Widget - Version 3.0.1

Version Description

  • Bug fix: Not able to get all registered post types & taxonomies until after widget init. Had to reorder some code.
  • Bug fix: when getting post types for display in widget admin. (Props: @angelfish276).
Download this release

Release Info

Developer dpe415
Plugin Icon wp plugin Flexible Posts Widget
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0 to 3.0.1

Files changed (2) hide show
  1. flexible-posts-widget.php +40 -21
  2. readme.txt +8 -3
flexible-posts-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Flexible Posts Widget
4
  Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
5
  Author: dpe415
6
  Author URI: http://dpedesign.com
7
- Version: 3.0
8
  Description: An advanced posts display widget with many options: get posts by post type, taxonomy & term; sorting & ordering; feature images; custom templates and more.
9
  License: GPL2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -31,14 +31,14 @@ if( !defined('ABSPATH') )
31
  die('-1');
32
 
33
  if( !defined('DPE_FP_Version') )
34
- define( 'DPE_FP_Version', '3.0' );
35
 
36
 
37
  // Load the widget on widgets_init
38
  function dpe_load_flexible_posts_widget() {
39
  register_widget('DPE_Flexible_Posts_Widget');
40
  }
41
- add_action('widgets_init', 'dpe_load_flexible_posts_widget');
42
 
43
 
44
  /**
@@ -60,23 +60,6 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
60
  );
61
 
62
  $this->directory = plugins_url( '/', __FILE__ );
63
- $this->posttypes = get_post_types( array('public' => true ), 'objects' );
64
- $this->taxonomies = get_taxonomies( array('public' => true ), 'objects' );
65
- $this->thumbsizes = get_intermediate_image_sizes();
66
- $this->orderbys = array(
67
- 'date' => 'Publish Date',
68
- 'title' => 'Title',
69
- 'menu_order' => 'Menu Order',
70
- 'ID' => 'Post ID',
71
- 'author' => 'Author',
72
- 'name' => 'Post Slug',
73
- 'comment_count' => 'Comment Count',
74
- 'rand' => 'Random',
75
- );
76
- $this->orders = array(
77
- 'ASC' => 'Ascending',
78
- 'DESC' => 'Descending',
79
- );
80
 
81
  $this->register_hooks(); // Register actions & filters
82
  $this->register_sns( $this->directory ); // Register styles & scripts
@@ -154,6 +137,24 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
154
  function update( $new_instance, $old_instance ) {
155
 
156
  // Get our defaults to test against
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  $pt_names = get_post_types( array('public' => true ), 'names' );
158
  $tax_names = get_taxonomies( array('public' => true ), 'names' );
159
  $tax_names[] = 'none';
@@ -213,6 +214,24 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
213
  * @param array $instance Previously saved values from database.
214
  */
215
  function form( $instance ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
 
217
  $instance = wp_parse_args( (array) $instance, array(
218
  'title' => '',
@@ -327,7 +346,7 @@ class DPE_Flexible_Posts_Widget extends WP_Widget {
327
 
328
  $output = '<ul class="categorychecklist posttypechecklist form-no-clear">';
329
  foreach ( $posttypes as $type ) {
330
- $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $type->name ) . '" type="checkbox" name="' . $this->get_field_name('posttype') . '[]"' . checked( in_array( $type->name, $posttype ), true, false ) . ' /> ' . esc_html( $type->labels->name ) . "</label></li>\n";
331
  }
332
  $output .= "</ul>\n";
333
 
4
  Plugin URI: http://wordpress.org/extend/plugins/flexible-posts-widget/
5
  Author: dpe415
6
  Author URI: http://dpedesign.com
7
+ Version: 3.0.1
8
  Description: An advanced posts display widget with many options: get posts by post type, taxonomy & term; sorting & ordering; feature images; custom templates and more.
9
  License: GPL2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
31
  die('-1');
32
 
33
  if( !defined('DPE_FP_Version') )
34
+ define( 'DPE_FP_Version', '3.0.1' );
35
 
36
 
37
  // Load the widget on widgets_init
38
  function dpe_load_flexible_posts_widget() {
39
  register_widget('DPE_Flexible_Posts_Widget');
40
  }
41
+ add_action('widgets_init', 'dpe_load_flexible_posts_widget' );
42
 
43
 
44
  /**
60
  );
61
 
62
  $this->directory = plugins_url( '/', __FILE__ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  $this->register_hooks(); // Register actions & filters
65
  $this->register_sns( $this->directory ); // Register styles & scripts
137
  function update( $new_instance, $old_instance ) {
138
 
139
  // Get our defaults to test against
140
+ $this->posttypes = get_post_types( array('public' => true ), 'objects' );
141
+ $this->taxonomies = get_taxonomies( array('public' => true ), 'objects' );
142
+ $this->thumbsizes = get_intermediate_image_sizes();
143
+ $this->orderbys = array(
144
+ 'date' => 'Publish Date',
145
+ 'title' => 'Title',
146
+ 'menu_order' => 'Menu Order',
147
+ 'ID' => 'Post ID',
148
+ 'author' => 'Author',
149
+ 'name' => 'Post Slug',
150
+ 'comment_count' => 'Comment Count',
151
+ 'rand' => 'Random',
152
+ );
153
+ $this->orders = array(
154
+ 'ASC' => 'Ascending',
155
+ 'DESC' => 'Descending',
156
+ );
157
+
158
  $pt_names = get_post_types( array('public' => true ), 'names' );
159
  $tax_names = get_taxonomies( array('public' => true ), 'names' );
160
  $tax_names[] = 'none';
214
  * @param array $instance Previously saved values from database.
215
  */
216
  function form( $instance ) {
217
+
218
+ $this->posttypes = get_post_types( array('public' => true ), 'objects' );
219
+ $this->taxonomies = get_taxonomies( array('public' => true ), 'objects' );
220
+ $this->thumbsizes = get_intermediate_image_sizes();
221
+ $this->orderbys = array(
222
+ 'date' => 'Publish Date',
223
+ 'title' => 'Title',
224
+ 'menu_order' => 'Menu Order',
225
+ 'ID' => 'Post ID',
226
+ 'author' => 'Author',
227
+ 'name' => 'Post Slug',
228
+ 'comment_count' => 'Comment Count',
229
+ 'rand' => 'Random',
230
+ );
231
+ $this->orders = array(
232
+ 'ASC' => 'Ascending',
233
+ 'DESC' => 'Descending',
234
+ );
235
 
236
  $instance = wp_parse_args( (array) $instance, array(
237
  'title' => '',
346
 
347
  $output = '<ul class="categorychecklist posttypechecklist form-no-clear">';
348
  foreach ( $posttypes as $type ) {
349
+ $output .= "\n<li>" . '<label class="selectit"><input value="' . esc_attr( $type->name ) . '" type="checkbox" name="' . $this->get_field_name('posttype') . '[]"' . checked( in_array( $type->name, (array)$posttype ), true, false ) . ' /> ' . esc_html( $type->labels->name ) . "</label></li>\n";
350
  }
351
  $output .= "</ul>\n";
352
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dpe415
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJKSKHJWYAWDU
4
  Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  Requires at least: 3.2
6
- Tested up to: 3.5
7
- Stable tag: 3.0
8
  License: GPL2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -91,6 +91,11 @@ Edit the new file in your theme to your desired HTML layout. Please do not edit
91
 
92
  == Changelog ==
93
 
 
 
 
 
 
94
  = 3.0 =
95
  * Allow widgets to query by post type and/or taxonomy & term instead of just one or the other. (Props: @vernal)
96
  * Allow widgets to query by multiple post types and multiple terms within the same taxonomy. (Props: @vernal)
@@ -111,7 +116,7 @@ Edit the new file in your theme to your desired HTML layout. Please do not edit
111
  * Miscellaneous admin improvements.
112
 
113
  = 1.0.5 =
114
- * Bug fix - Removed post_status 'private' from wp_queries. We don't want to show private posts in our loops.
115
 
116
  = 1.0.4 =
117
  * Fixed an issue where post thumbnails aren't displaying.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=DJKSKHJWYAWDU
4
  Tags: widget, widgets, posts, categories, tags, recent posts, thumbnails, custom post types, custom taxonomies, feature image
5
  Requires at least: 3.2
6
+ Tested up to: 3.5.1
7
+ Stable tag: 3.0.1
8
  License: GPL2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
91
 
92
  == Changelog ==
93
 
94
+ = 3.0.1 =
95
+ * Bug fix: Not able to get all registered post types & taxonomies until after widget init. Had to reorder some code.
96
+ * Bug fix: when getting post types for display in widget admin. (Props: @angelfish276).
97
+
98
+
99
  = 3.0 =
100
  * Allow widgets to query by post type and/or taxonomy & term instead of just one or the other. (Props: @vernal)
101
  * Allow widgets to query by multiple post types and multiple terms within the same taxonomy. (Props: @vernal)
116
  * Miscellaneous admin improvements.
117
 
118
  = 1.0.5 =
119
+ * Bug fix: Removed post_status 'private' from wp_queries. We don't want to show private posts in our loops.
120
 
121
  = 1.0.4 =
122
  * Fixed an issue where post thumbnails aren't displaying.