Display Posts Shortcode - Version 3.0.1

Version Description

Download this release

Release Info

Developer billerickson
Plugin Icon 128x128 Display Posts Shortcode
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

Files changed (3) hide show
  1. CHANGELOG.md +4 -0
  2. display-posts-shortcode.php +21 -11
  3. readme.txt +5 -1
CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
  # Change Log
2
  All notable changes to this project will be documented in this file, formatted via [this recommendation](http://keepachangelog.com/).
3
 
 
 
 
 
4
  ### [3.0.0]
5
  #### Added
6
  * Added author_id parameter, see #195
1
  # Change Log
2
  All notable changes to this project will be documented in this file, formatted via [this recommendation](http://keepachangelog.com/).
3
 
4
+ ### [3.0.1]
5
+ #### Changed
6
+ * Don't add empty parameters to the query, see #207
7
+
8
  ### [3.0.0]
9
  #### Added
10
  * Added author_id parameter, see #195
display-posts-shortcode.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Display Posts
4
  * Plugin URI: https://displayposts.com
5
  * Description: Display a listing of posts using the [display-posts] shortcode
6
- * Version: 3.0.0
7
  * Author: Bill Erickson
8
  * Author URI: https://www.billerickson.net
9
  *
@@ -15,7 +15,7 @@
15
  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
  *
17
  * @package Display Posts
18
- * @version 2.9.1
19
  * @author Bill Erickson <bill@billerickson.net>
20
  * @copyright Copyright (c) 2011, Bill Erickson
21
  * @link http://www.billerickson.net/shortcode-to-display-posts/
@@ -162,17 +162,27 @@ function be_display_posts_shortcode( $atts ) {
162
 
163
  // Set up initial query for post
164
  $args = array(
165
- 'cat' => $category_id,
166
- 'category_name' => $category,
167
- 'order' => $order,
168
- 'orderby' => $orderby,
169
- 'perm' => 'readable',
170
- 'post_type' => be_dps_explode( $post_type ),
171
- 'posts_per_page' => $posts_per_page,
172
- 's' => $s,
173
- 'tag' => $tag,
174
  );
175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  // Date query.
177
  if ( ! empty( $date ) || ! empty( $time ) || ! empty( $date_query_after ) || ! empty( $date_query_before ) ) {
178
  $initial_date_query = $date_query_top_lvl = array();
3
  * Plugin Name: Display Posts
4
  * Plugin URI: https://displayposts.com
5
  * Description: Display a listing of posts using the [display-posts] shortcode
6
+ * Version: 3.0.1
7
  * Author: Bill Erickson
8
  * Author URI: https://www.billerickson.net
9
  *
15
  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
  *
17
  * @package Display Posts
18
+ * @version 3.0.1
19
  * @author Bill Erickson <bill@billerickson.net>
20
  * @copyright Copyright (c) 2011, Bill Erickson
21
  * @link http://www.billerickson.net/shortcode-to-display-posts/
162
 
163
  // Set up initial query for post
164
  $args = array(
165
+ 'perm' => 'readable'
 
 
 
 
 
 
 
 
166
  );
167
 
168
+ // Add args if they aren't empty
169
+ if( !empty( $category_id ) )
170
+ $args['cat'] = $category_id;
171
+ if( !empty( $category ) )
172
+ $args['category_name'] = $category;
173
+ if( !empty( $order ) )
174
+ $args['order'] = $order;
175
+ if( !empty( $orderby ) )
176
+ $args['orderby'] = $orderby;
177
+ if( !empty( $post_type ) )
178
+ $args['post_type'] = be_dps_explode( $post_type );
179
+ if( !empty( $posts_per_page ) )
180
+ $args['posts_per_page'] = $posts_per_page;
181
+ if( !empty( $s ) )
182
+ $args['s'] = $s;
183
+ if( !empty( $tag ) )
184
+ $args['tag'] = $tag;
185
+
186
  // Date query.
187
  if ( ! empty( $date ) || ! empty( $time ) || ! empty( $date_query_after ) || ! empty( $date_query_before ) ) {
188
  $initial_date_query = $date_query_top_lvl = array();
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: billerickson
3
  Tags: shortcode, pages, posts, page, query, display, list
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
- Stable tag: 3.0.0
7
 
8
  Add a listing of content on your website using a simple shortcode. Filter the results by category, author, and more.
9
 
@@ -66,6 +66,10 @@ Here are [tutorials for popular event calendar plugins](https://displayposts.com
66
 
67
  == Changelog ==
68
 
 
 
 
 
69
  **Version 3.0.0**
70
  * Added author_id parameter, see [#195](https://github.com/billerickson/display-posts-shortcode/issues/195)
71
  * Added has_password parameter
3
  Tags: shortcode, pages, posts, page, query, display, list
4
  Requires at least: 3.0
5
  Tested up to: 5.0
6
+ Stable tag: 3.0.1
7
 
8
  Add a listing of content on your website using a simple shortcode. Filter the results by category, author, and more.
9
 
66
 
67
  == Changelog ==
68
 
69
+ **Version 3.0.1**
70
+ * Prevent empty empty parameters from being added to the query, see [#207](https://github.com/billerickson/display-posts-shortcode/issues/207)
71
+
72
+
73
  **Version 3.0.0**
74
  * Added author_id parameter, see [#195](https://github.com/billerickson/display-posts-shortcode/issues/195)
75
  * Added has_password parameter