Display Post Shortcodes Helps Show WordPress Content

wordpress post shortcodes plugin

I love the Display Post Shortcodes plugin.

I’m not alone because Display Post Shortcodes has an almost perfect rating on WordPress.org and is an official WordPress.com plugin.

Why is this plugin so useful? Because it allows you to organize and display your WordPress content using a series of simple shortcodes.

Here are 5 examples of what Display Post Shortcodes can do.

#1. Posts from a certain tag or category

The most basic thing that Display Post Shortcodes can do is display a list of content.

This shortcode will list the 20 most recent posts with the tag ‘thru-hikers’:

[display-posts tag=”thru-hikers” posts_per_page=”20″]

media_1404851631747.png

Here’s how this would appear in your post or page:

media_1404851671078.png

If you wanted to show content from a category, instead of a tag, use category=”must-read”.

#2. Adding extra information

You can pull information from your WordPress content and add it to the shortcode. For example, this will include the date:

[display-posts tag=”thru-hikers” include_date=”true”]

This is how it will appear on your site:

media_1404853546278.png

Another examples of this is include_excerpt=”true” which would add a snippet from your content:

media_1404854042243.png

#3. Adding images

You can images to your shortcodes like this: image_size=”thumbnail” so that the full shortcode is:

[display-posts tag=”thru-hikers” image_size=”thumbnail”]

That would produce this output:

media_1404851731114.png

You can see that the images are mis-aligned. You can fix that with some CSS:

.display-posts-listing .listing-item {
clear: both;
}
.display-posts-listing img {
float: left;
margin: 0 10px 10px 0;
}

#4. Ordering the content

You can order the content inside your shortcode. For example, you can order the content alphabetically using order=”ASC” orderby=”title”.

The full shortcode would be:

[display-posts tag=”thru-hikers” orderby=”title” order=”ASC”]

That would produce this output:

media_1404853864594.png

You can see a full list of the ways to order content by clicking here. Examples include:

  • orderby=”author” – Order by author
  • orderby=”rand” – Random order.
  • orderby=”comment_count” – Order by number of comments

#5. Different display options

By default the Display Post Shortcodes plugin uses an unordered list. We can change that by adding something like this: wrapper=”ol”.

This will display posts as an ordered list:

media_1404852017042.png

Another example is wrapper=”div” which will wrap each item inside a div.

More options and WP_Query

You can find out more about the options available in Display Post Shortcodes by visiting these links:

What Display Post Shortcodes does is create database queries on your behalf. It relies on the WP_Query class.

Our WordPress teacher Topher explains why WP_Query is so powerful:

 

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
4 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Ángel Candelaria
Ángel Candelaria
9 years ago

Thanks for this useful information. I’ve been looking for something like this for some time to display a list of posts on a specific category. I see that with this plugin it is possible, and the best part is that the list will update itself as I add new articles to that category. Just set and forget.

steve
steve
9 years ago

Yes, that’s right Angel. All those shortcodes will update automatically.

Ideal Jamere
Ideal Jamere
8 years ago

Thanks for the info. I am going to try it out,

Rajveer
Rajveer
8 years ago

If i want to add new class to coming posts div then how can i do this. I want to show blog posts into two columns on blog page. Any help would be much appreciated.

4
0
Would love your thoughts, please comment.x
()
x