WordPress Shortcodes, Part 6 – [ playlist ]


In our ongoing series relating to WordPress shortcodes (see part 1, 2, 3, 4, and 5), we now come to the ‘[ playlist ]’ shortcode. This shortcode would be used to create some sort of easily viewable list of media files available on a page or across an entire website. How would this shortcode prove useful?

Let’s say you are running a church website that offered streaming MP3 sermon files. Creating a playlist would enable you to simply paste the code into any page or post rather than requiring you to create a duplicate playlist.

The ‘[ playlist ]’ shortcode is one of the more complex shortcodes because of the many attributes involved. In this post, we will only provide an overview of how it works. If you need more information, the official WordPress documentation provides the details.

According to the documentation, the default attributes of the ‘[ playlist ]’ shortcode include:

  • type – Classify media types as either audio or video. The default setting is audio.
  • order – Designate how the shortcode sorts various media files. They can be sorted according to ascending (ASC) or descending (DESC) order. The default is ascending. There is no provision for random sorting.
  • orderby – A more advanced sort order attribute, orderby allows you to order a playlist according to single or multiple columns of ID information. As discussed in one of our earlier posts, you can assign individual media types unique ID numbers so that they can be easily retrieved from your library.
  • id – Similar to what was described for adding unique ID numbers to media types, you can also apply ID numbers to playlists. This allows you to create multiple playlists that can be then pasted into pages and posts with ease.
  • ids – This attribute is an array attribute that creates a playlist using specific ID attachments. The default setting here is ’empty’, so you do not have to worry about including this attribute in your code unless it is absolutely necessary.
  • exclude – You can exclude certain media files from your playlist using this attribute.
  • style – This attribute is a string attribute that lets you choose either a light or dark presentation style for your playlist. The default is light.
  • tracklist – Using this attribute determines whether the playlist is viewable or hidden.
  • tracknumbers – This attribute determines whether or not track numbers are viewable.
  • images – An attribute used to either hide or display thumbnail images in a playlist.
  • artists — Use this attribute to either hide or display artist information along with file names.

As with every other WordPress shortcode, you build your code according to the attributes you want to use. The WordPress documentation offers the following example for a playlist utilizing the ‘type’, ‘ids’, and ‘style’ attributes; notice that the attributes appear one after another with just a space between:

[ playlist type="video" ids="123,456,789" style="dark" ]

If this shortcode is too complex for you, there are plugins available that do the same thing. Take a look through the WordPress plugins library to see what you can find.

Our Recommended Wordpress Web Hosting Provider


Get a 50% Discount by using our link.


Reliable host, with excellent customer service and an easy one-click Wordpress installation. Our recommendation to host a Wordpress blog.

Leave a Reply

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