and like us on FB

This article will show you how to include a list of posts in a series based on WordPress tags. An older version of this shortcode included both a series list and related list in the same function. However, because of the perceived attribute confusion and associated complexity we’ve sensibly split them into two.

A tag, not unlike a social hashtag, can often be unique to tie a specific sub-group of articles together. This article will tie these distinct hashtags into a reading list – not unlike an article split into chapters of a book.

WordPress tags must be the most misunderstood and underutilized feature of WordPress. They should normally be used to tie posts together into a sub-set of associated or connected articles. They’re often used, however, in a haphazard way with tagged words that are rarely connected and seldom structured.

Since we don’t have any series posts (yet) we’ll bundle all the posts tagged with wp_query into a series (in reality the posts are better served by a related reading list). The shortcode of [series tags="108"] returns the following:

  1. Display a List of Child Pages With WordPress ShortcodeMay 28, 2017
  2. Display Future Scheduled Posts in WordPressJune 1, 2017
  3. Display the Total Number of Scheduled, Draft, or Published Posts (or by Author) with WordPress ShortcodeJune 24, 2017
  4. Display Random Posts in WordPressJune 27, 2017
  5. Create a Series Reading List with WordPress ShortcodeJuly 2, 2017
  6. WordPress Post & Page Dropdown MenuJuly 7, 2017

Scheduled (and unlinked) articles may be included in the list with an icon and text indicating their status. Shortcode of [series tags="108" status="publish,future"] returns the following list. The screenshot was taken when most articles were scheduled and, as such, this article shows as both a future article and the current page.

Create a Series Reading List with WordPress Shortcode

WordPress Shortcode

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Shortcode Attributes

While there are a quite a few attributes, very few are required other than tags.

tags

The only required attribute is tags. While a comma-delimited list of tags is permitted, it’s best-practice to only use a specific tags that will tie your content together.

status

By default the posts returned will have a status of publish. To include future posts (to give readers an indication of the rest of the scheduled series), use status="publish,future".

image

If the image value is empty, we’ll use the HTML entity to render a clock (&#9202).

align

The align attribute is used to position the image defined above. Use it if the image doesn’t center correctly.

description

To render an excerpt under each post, use description="1".

format

After the title we’ll print the date. If you want to use anything other than the default WP formatting (defined by you in your control panel), format the date with PHP’s date() formatting.

remove

If you’re required to remove leading text from the description excerpt, use remove="the text".

words

The excerpt is truncated to 15 words by default. Alter it with words="25".

number

In almost all circumstances you will return the series in a numbered list. To use an unordered list, use number="1".

headingstyle

The headingstyle is the default style applied to your post title. Defaults to font-weight: bold;.

datestyle

The datestyle is the default style applied to your post date. Defaults to font-size: 0.9em;.

textstyle

The textstyle is the default style applied to your post description (excerpt). Defaults to font-size: 0.9em;.

currentpagestyle

The currentpagestyle is the default style applied to the current page title. Defaults to text-decoration: none; font-weight: normal;.

cache

To avoid repeated queries we’ll cache the results for 2 hours by default. If you don’t plan on regular updates to your series, increase this value.

Considerations

  • Using a textbox or some other means of formatting you can jazz up the result a little.

  • Our blind shortcode will hide the series until clicked. It won’t result in the same page-view conversions, but it will clear up the clutter.

[ Click for the WP_Query Series ]

  • While the shortcode can be used to return any number and type of post, this isn’t the intended use. Instead, we’ve built purpose shortcodes to reduce the complexity.

Download

Title: Create a Series Reading List with WordPress Shortcode
Description: Create a Series Reading List with WordPress Shortcode. Renders a WP series of posts based on tag.
Download: Shortcode (V0.2) | WP Plugin (V0.2) | | Plugin Page

Shortt URL for this post: http://shor.tt/1QZr