Find available shortcodes

Display a grid of tagged content

The [listtags] shortcode gathers everything that carries one tag and shows it as a grid of cards. Each card has the item’s featured image, if it has one, and its title. Use it to build a page about a topic or a campaign without linking to each item by hand: tag the items, add the shortcode, and the page keeps itself up to date.

Tags can be added to news, news updates, blog posts, events, tasks, projects, teams, training courses and videos. Pages cannot be tagged, so pages never appear in this grid. To list the sub-pages of a page, use the landing page shortcodes instead.

Add the listtags shortcode

Type the shortcode where you want the grid to appear, in the Classic Editor:

[listtags tag="wellbeing"]

Or select the Insert shortcode button on the editor toolbar, choose List by tag, fill in the boxes and select Insert. The button lists every Govintra shortcode with its settings, so you do not need to remember them.

Attributes of listtags

tag

Required. The slug of the tag, not its name: lower case, with hyphens instead of spaces. A tag named “Mental health” has the slug mental-health. Find the slug in the Slug column of the Tags screen under any tagged content type, such as News, then Tags. One tag only. If the tag does not exist or nothing carries it, the shortcode shows nothing.

format

Optional. Leave it out for compact cards showing the image and title. Set format="full" to add the publication date and an excerpt to each card. The excerpt is the item’s own excerpt if one has been written, otherwise the first 20 words of its content.

num

Optional. The most cards to show, newest first. The default is 24. Use num="-1" to show every item with the tag, which on a busy tag can make a very long page.

What listtags shows

The newest published items with the tag, from every content type that can be tagged, up to the number set by num. For a short list ordered by each type’s own logic, use the shorttags shortcode.

The cards sit three across on a wide screen and stack on a phone. The image is the item’s featured image at the medium size, linked to the item, so items look best when each has a featured image with the same shape. An item with no featured image shows its title only. See Set a featured image and Generate an excerpt.

Examples of listtags

A grid of everything tagged “wellbeing”, titles and images only:

[listtags tag="wellbeing"]

The same grid with a date and short excerpt on each card, which suits news and blog posts:

[listtags tag="wellbeing" format="full"]

A campaign page: tag the news story, the guidance task and the training course with new-starters, then add:

[listtags tag="new-starters" format="full"]

Everything ever tagged “archive-2019”, however many items:

[listtags tag="archive-2019" num="-1"]

Related