WordPress Display Posts Shortcodes
Display Arguments
Arguments are used to customise how the posts are displayed. Below is a list of common arguments you can add to your Display Posts shortcode and examples of how the shortcode should look with the argument added.
author
Specify the post author
Default: empty
Example:
[display-posts author="bill"]
category
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"]
date_format
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"]
id
Specify a specific post ID (or multiple post IDs) to display.
Default: empty
Example:
[display-posts id="9, 10"]
image_size
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_content
Include the full post content after the title.
Default: empty
Example:
[display-posts include_content="true"]
include_date
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_excerpt
Include the post’s excerpt after the title (and date if provided).
Default: empty
Example:
[display-posts include_excerpt="true"]
offset
The number of posts to pass over
Default: 0
Example:
[display-posts offset="3"]
order
Specify whether posts are ordered in descending order (DESC) or ascending order (ASC).
Default: DESC
Example:
[display-posts order="ASC"]
orderby
Specify what the posts are ordered by. See the available parameters here.
Default: date
Example:
[display-posts orderby="title"]
portfolio_type
If you are using the Portfolio post type, use this to get items from a specific portfolio type.
post_parent
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"]
post_status
Show posts associated with a certain post status
Default: publish
Example:
[display-posts post_status="publish, future"]
post_type
Specify which post type to use. You can use a default one (post or page).
Default: post
Example:
[display-posts post_type="page"]
posts_per_page
How many posts to display.
Default: 10
Example:
[display-posts posts_per_page="5"]
tag
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"]
wrapper
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"]
