Display Posts Shortcode

The Display Posts Shortcode allows you to fine-tune the posts you wish to display on a page.

Adding the Shortcode
Multiple Taxonomy Queries
Image Alignment

The [display-posts] shortcode will not work for a Business Plan site using plugins. Various plugins offer similar functionality.

Adding the Shortcode

  • Add the shortcode [display-posts] in a post or page
  • To style the posts, or display specific posts, use arguments to tell the code to only display posts based on parameters you set, such as tag, categories, etc. See the examples below for more info.
Simply writing in any post or page will show a list of published blog posts.

New posts, and updates to existing posts can take up to one hour to be displayed anywhere you are using this shortcode.

↑ Table of Contents ↑


[display-posts tag="advanced" posts_per_page="20"]

This will list the 20 most recent posts with the tag ‘advanced’.

[display-posts tag="advanced" image_size="thumbnail"]

This will list the 10 most recent posts tagged ‘Advanced’ and display a post image using the ‘Thumbnail’ size.

[display-posts category="must-read" posts_per_page="-1" include_date="true" order="ASC" orderby="title"]

This will list every post in the Must Read category, in alphabetical order, with the date appended to the end.

[display-posts wrapper="ol"]

This will display posts as an ordered list. Options are ul for unordered lists (default), ol for ordered lists, or div for divs.

[display-posts id="14,3"]

This will display only the posts with an ID of 14 and 3.

↑ Table of Contents ↑


Specify the post author
Default: empty
Example: [display-posts author="bill"]

Specify the category slug (or comma separated list of category slugs). View this shortcode in action on this example site.
Default: empty
Example: [display-posts category="fishing,hiking"]

Specify the date format used when include_date is true. See Formatting Date and Time on the Codex for more information.
Default: ‘(n/j/Y)’
Example: [display-posts include_date="true" date_format="F j, Y"]

Specify a specific post ID (or multiple post IDs) to display.
Default: empty
Example: [display-posts id="9, 10"]

Specify an image size for displaying the featured image, if the post has one. The image_size can be set to thumbnail, medium, large (all controlled from Settings > Media).
Default: empty
Example: [display-posts image_size="thumbnail"]

if you’re using a theme that supports Content Options, and have it set to not show featured images on Pages, the image_size argument will also have no effect on shortcodes used on a page on the site – featured images will not show for any posts added via the shortcode even if the shortcode says they should be shown.

Include the full post content after the title.
Default: empty
Example: [display-posts include_content="true"]

Include the post’s date after the post title. The default format is (7/30/12), but this can be customized using the ‘date_format’ parameter.
Default: empty
Example [display-posts include_date="true"]

Include the post’s excerpt after the title (and date if provided).
Default: empty
Example: [display-posts include_excerpt="true"]

The number of posts to pass over
Default: 0
Example: [display-posts offset="3"]

Specify whether posts are ordered in descending order (DESC) or ascending order (ASC).
Default: DESC
Example: [display-posts order="ASC"]

Specify what the posts are ordered by. See the available parameters here.
Default: date
Example: [display-posts orderby="title"]

If you are using the Portfolio post type, use this to get items from a specific portfolio type.

Display the pages that are a child of a certain page. You can either specify an ID or ‘current’, which displays the children of the current page.
Default: empty
Example: [display-posts post_type="page" post_parent="8"]

Show posts associated with a certain post status
Default: publish
Example: [display-posts post_status="publish, future"]

Specify which post type to use. You can use a default one (post or page). For Portfolios use “jetpack-portfolio”.  Similarly, for Testimonials use “jetpack-testimonial”.
Default: post
Example: [display-posts post_type="page"]

How many posts to display.
Default: 10
Example: [display-posts posts_per_page="5"]

Specify the tag slug (or comma separated list of tag slugs)
Default: empty
Example: [display-posts tag="tag1, tag2"]

taxonomy, tax_term, and tax_operator
Use these parameters to do advanced taxonomy queries. Use ‘taxonomy’ for the taxonomy you’d like to query, ‘tax_term’ for the term slug (or terms) you’d like to include, and ‘operator’ to change how the query uses those terms (most likely this field will not be needed).
Default: ‘taxonomy’ = empty , ‘tax_term’ = empty , ‘tax_operator’ = ‘IN’
Example: [display-posts taxonomy="color" tax_term="blue, green"]

What type of HTML should be used to display the listings. It can be an unordered list (ul), ordered list (ol), or divs (div) which you can then style yourself.
Default: ul
Example: [display-posts wrapper="ol"]

↑ Table of Contents ↑

Multiple Taxonomy Queries

While most people will only ever need a single taxonomy query, this shortcode supports an infinite number of taxonomy queries. Let’s say you wanted to get all posts in the category “featured” and also tagged “homepage”. We’ll use a shortcode that looks like this:

[display-posts taxonomy="category" tax_term="featured" taxonomy_2="post_tag" tax_2_term="homepage"]

You can string as many of those as you like, just start the count at 2. In the field listing below, replace (count) with an actual number.

Here are the available fields:

Which taxonomy to query
Default: empty

Which terms to include (if more than one, separate with commas)
Default: empty

How to query the terms (IN, NOT IN, or AND)
Default: IN

Describe the relationship between the multiple taxonomy queries (should the results match all the queries or just one of them). Available options: AND and OR
Default: AND

↑ Table of Contents ↑

Image Alignment

A common request is to display a list of posts with title, excerpt, and the thumbnail aligned to the right. Here’s the shortcode you might use:

[display-posts include_excerpt="true" image_size="thumbnail" wrapper="div"]

This includes the excerpt, adds an image of the “thumbnail” size (you can customize the image sizes in Settings > Media), and tells it to present the list without bullets.

In order to get the image floating to the right, add this to your custom CSS file (requires the Premium or Business upgrade):

.display-posts-listing .alignleft {
    float: right;
    margin: 0 0 5px 5px;

↑ Table of Contents ↑


The Display Posts Shortcode has a limit of 100 posts displayed.

Not quite what you're looking for?

Get Help