Display Posts Shortcode Plugin

The display posts shortcode plugin allows you to pull in posts or pages into a wordpress page or post, without having to mess around with any custom template files or php.

Custom.css

This is the custom css I use to style the listing up a bit.

.listing-item img {float:left; padding-right:10px; width:100px;}
.listing-item .title {font-size:1.5em;}
.listing-item .date {font-size:1em;color:#999;}
.listing-item .excerpt-dash {display:none;}
.listing-item {display:block;width: 100%;padding-top:5px;margin: 10px 0 10px;clear: both;}
.listing-item .excerpt {display:block;}

Variations

[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 taxonomy=”color” tax_term=”blue” include_excerpt=”true”]

This will display the title and excerpt of the 10 most recent posts marked “blue” in the custom taxonomy “color”.

[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.

Arguments

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

category
Specify the category slug (or comma separated list of category slugs)
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 > Reading), or a custom image size.
Default: empty
Example: [display-posts image_size=”thumbnail”]

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”]

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), or a custom post type you’ve created.
Default: post
Example: [display-posts post_type=”event”]

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

tag
Display posts from a specific tag, or tags
Default: empty
Example: [display-posts tag=”tag1, tag2″]

taxonomy, tax_term, and tax_operator
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”]

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *