Display a list of posts

The [listposts] shortcode puts a short list of the latest items from one content type on any page: a few news stories about a subject, the last five blog posts from a group, or the next three events. Each item is a linked title. Events also show their date. It is a plain list with no images or excerpts, which makes it useful in a sidebar or part-way down a page.

Add the listposts shortcode

Type the shortcode where the list should appear, in the Classic Editor:

[listposts type="news" num="3"]

Or select the Insert shortcode button on the editor toolbar, choose List posts, pick the type and fill in the other boxes, then select Insert.

Attributes of listposts

type

Required. One of news, news-update, blog or event. Any other value, including task or page, shows nothing. For tasks, projects, training and other content types use the shorttags shortcode.

cat

Optional. The slug of a category in that type’s own category list: a news type for news, a news update type for news updates, a blog category for blog posts, an event type for events. Find the slug in the Slug column of News, then News types (or News updates, then News update types; Blog posts, then Blog categories; Events, then Event types). One category only. Leave it out for all categories.

tag

Optional. The slug of a tag. Only items with that tag are listed. If both cat and tag are given, items must match both.

num

Optional. How many items to show. The default is 3.

What listposts shows

A bulleted list of linked titles, newest first, of published items only. If nothing matches, the shortcode shows nothing at all, so a page never shows an empty heading.

For events, the list is different: it shows only events that start today or later, soonest first, and each entry has the event’s start date after the title. Past events are never listed.

Examples of listposts

The three most recent news stories:

[listposts type="news" num="3"]

The five latest news stories in the “human-resources” news type:

[listposts type="news" cat="human-resources" num="5"]

The latest service alerts, a news update type:

[listposts type="news-update" cat="service-alerts" num="3"]

Blog posts tagged “wellbeing” from the “staff-network” blog category:

[listposts type="blog" cat="staff-network" tag="wellbeing" num="5"]

The next four events of the “training” event type:

[listposts type="event" cat="training" num="4"]

Related