Display Posts Shortcode - Version 1.8

Version Description

Download this release

Release Info

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

Code changes from version 1.7 to 1.8

Files changed (2) hide show
  1. display-posts-shortcode.php +5 -6
  2. readme.txt +8 -57
display-posts-shortcode.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Display Posts Shortcode
4
  * Plugin URI: http://www.billerickson.net/shortcode-to-display-posts/
5
  * Description: Display a listing of posts using the [display-posts] shortcode
6
- * Version: 1.7
7
  * Author: Bill Erickson
8
  * Author URI: http://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 1.7
19
  * @author Bill Erickson <bill@billerickson.net>
20
  * @copyright Copyright (c) 2011, Bill Erickson
21
  * @link http://www.billerickson.net/shortcode-to-display-posts/
@@ -65,7 +65,7 @@ function be_display_posts_shortcode($atts) {
65
 
66
  // Set up initial query for post
67
  $args = array(
68
- 'post_type' => $post_type,
69
  'tag' => $tag,
70
  'category_name' => $category,
71
  'posts_per_page' => $posts_per_page,
@@ -125,7 +125,7 @@ function be_display_posts_shortcode($atts) {
125
 
126
  $listing = new WP_Query( apply_filters( 'display_posts_shortcode_args', $args, $atts ) );
127
  if ( !$listing->have_posts() )
128
- return;
129
 
130
  $inner = '';
131
  while ( $listing->have_posts() ): $listing->the_post(); global $post;
@@ -152,5 +152,4 @@ function be_display_posts_shortcode($atts) {
152
  $return = $open . $inner . $close;
153
 
154
  return $return;
155
- }
156
- ?>
3
  * Plugin Name: Display Posts Shortcode
4
  * Plugin URI: http://www.billerickson.net/shortcode-to-display-posts/
5
  * Description: Display a listing of posts using the [display-posts] shortcode
6
+ * Version: 1.8
7
  * Author: Bill Erickson
8
  * Author URI: http://www.billerickson.net
9
  *
15
  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
  *
17
  * @package Display Posts
18
+ * @version 1.8
19
  * @author Bill Erickson <bill@billerickson.net>
20
  * @copyright Copyright (c) 2011, Bill Erickson
21
  * @link http://www.billerickson.net/shortcode-to-display-posts/
65
 
66
  // Set up initial query for post
67
  $args = array(
68
+ 'post_type' => explode( ',', $post_type ),
69
  'tag' => $tag,
70
  'category_name' => $category,
71
  'posts_per_page' => $posts_per_page,
125
 
126
  $listing = new WP_Query( apply_filters( 'display_posts_shortcode_args', $args, $atts ) );
127
  if ( !$listing->have_posts() )
128
+ return apply_filters ('display_posts_shortcode_no_results', false );
129
 
130
  $inner = '';
131
  while ( $listing->have_posts() ): $listing->the_post(); global $post;
152
  $return = $open . $inner . $close;
153
 
154
  return $return;
155
+ }
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: billerickson
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MQKRBRFVRUV8C
4
  Tags: shortcode, pages, posts, page, query, display, list
5
  Requires at least: 3.0
6
- Tested up to: 3.2.1
7
- Stable tag: 1.7
8
 
9
  Display a listing of posts using the [display-posts] shortcode
10
 
@@ -16,61 +16,7 @@ Add the shortcode in a post or page, and use the arguments to query based on tag
16
 
17
  See the [WordPress Codex](http://codex.wordpress.org/Class_Reference/WP_Query) for information on using the arguments.
18
 
19
- The image_size can be set to thumbnail, medium, large (all controlled from Settings > Reading), or a [custom image size](http://codex.wordpress.org/Function_Reference/add_image_size).
20
-
21
- = Examples =
22
-
23
- [display-posts tag="advanced" posts_per_page="20"]
24
- This will list the 20 most recent posts with the tag *Advanced*.
25
-
26
- [display-posts tag="advanced" image_size="thumbnail"]
27
- This will list the 10 most recent posts tagged *Advanced* and display a post image using the *Thumbnail* size.
28
-
29
- [display-posts category="must-read" posts_per_page="-1" include_date="true" order="ASC" orderby="title"]
30
- This will list every post in the Must Read category, in alphabetical order, with the date appended to the end.
31
-
32
- [display-posts taxonomy="color" tax_term="blue" include_excerpt="true"]
33
- This will display the title and excerpt of the 10 most recent posts marked "blue" in the custom taxonomy "color".
34
-
35
- [display-posts wrapper="ol"]
36
- This will display posts as an ordered list. Options are ul for unordered lists (default), ol for ordered lists, or div for divs.
37
-
38
- [display-posts id="14,3"]
39
- This will display only the posts with an ID of 14 and 3.
40
-
41
- = Arguments =
42
-
43
- * tag
44
- * category
45
- * posts_per_page
46
- * id
47
- * order
48
- * orderby
49
- * include_date
50
- * include_excerpt
51
- * image_size
52
- * post_type
53
- * post_parent
54
- * taxonomy
55
- * tax_term
56
- * tax_operator
57
- * wrapper
58
-
59
- = Further Customizaion =
60
-
61
- `display_posts_shortcode_args`
62
- For customizing the $args passed to WP_Query. Useful if a query arg you want isn't already in the shortcode.
63
- Example: http://www.billerickson.net/code/display-posts-shortcode-exclude-posts/
64
-
65
- `display_posts_shortcode_output`
66
- For customizing the output of individual posts.
67
- Example: http://www.billerickson.net/code/display-posts-shortcode-full-content/
68
-
69
- `display_posts_shortcode_wrapper_open`
70
- `display_posts_shortcode_wrapper_close`
71
- For customizing the outer markup of the whole listing. By default it is a `ul` but
72
- can be changed to `ol` or `div` using the 'wrapper' attribute, or by using this filter.
73
- Example: http://www.billerickson.net/code/display-posts-shortcode-outer-markup/
74
 
75
  == Installation ==
76
 
@@ -81,6 +27,11 @@ Example: http://www.billerickson.net/code/display-posts-shortcode-outer-markup/
81
 
82
  == Changelog ==
83
 
 
 
 
 
 
84
  **Version 1.7**
85
 
86
  * Added `id` argument to specify specific post IDs
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MQKRBRFVRUV8C
4
  Tags: shortcode, pages, posts, page, query, display, list
5
  Requires at least: 3.0
6
+ Tested up to: 3.4.1
7
+ Stable tag: 1.8
8
 
9
  Display a listing of posts using the [display-posts] shortcode
10
 
16
 
17
  See the [WordPress Codex](http://codex.wordpress.org/Class_Reference/WP_Query) for information on using the arguments.
18
 
19
+ [Documentation](https://github.com/billerickson/display-posts-shortcode/wiki) | [Support Forum](https://github.com/billerickson/display-posts-shortcode/issues)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  == Installation ==
22
 
27
 
28
  == Changelog ==
29
 
30
+ **Version 1.8**
31
+
32
+ * Added `display_posts_shortcode_no_results` filter for displaying content if there's no posts matching current query.
33
+ * Add support for multiple post types. [display-posts post_type="page, post"]
34
+
35
  **Version 1.7**
36
 
37
  * Added `id` argument to specify specific post IDs