Languages: English • Shortcode 日本語 (Add your language)
The playlist shortcode implements the functionality of displaying a collection of WordPress audio or video files in a post using a simple Shortcode. This was added as of WordPress 3.9 and is used like this:
[playlist]
The playlist shortcode has several attributes, which are making it possible to alter its output.
The default values for the attributes are:
<?php array(
'type' => 'audio',
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post ? $post->ID : 0,
'include' => ,
'exclude' => ,
'style' => 'light',
'tracklist' => true,
'tracknumbers' => true,
'images' => true,
'artists' => true
);
Some values do set others, depending on their arguments. Keep that in mind when something does not work.
Generally, shortcodes are used by adding them to the content of the post editor.
Basic, with default values:
[playlist]
Changing style to dark:
[playlist style="dark"]
Changing type to video:
[playlist type="video"]
Specifying ids of audio files, it's the default, out of the media library:
[playlist ids="123,456,789"]
Specifying ids of video files out of the media library and changing style:
[playlist type="video" ids="123,456,789" style="dark"]
The playlist shortcode is located in wp-includes/media.php.
WordPress Shortcodes:
[audio]
,
[caption]
,
[embed]
,
[gallery]
,
[playlist]
,
[video]