WordPress: Playlist shortcode with external audio or video files

The new [playlist] shortcode ┬áin WordPress 3.9 is great, but we can’t use it for external files.

Here’s a solution I wrote on WPSE to use it for external files.

The plugin is hosted on GitHub.

Here’s version 0.05b for those who use PHP 5.1.x or PHP 5.2.x.

WordPress 4.0 support:

Please update to version 0.0.5+ of the plugin due to some small playlist changes in WordPress 4.0. Thanks.

Version 0.0.6, now supports with autoplay and the GitHub Updater support. It works on WordPress 4.0+.

Version 0.0.7 introduced the new shortcodes [_playlist] and [_track] and the support for the shortcodes [wpse_playlist] and [wpse_trac] will phase out.

The current version is 0.0.9.

Example 1a

This audio playlist:

is generated by the following shortcode:

[_playlist type="audio" tracklist="true" tracknumbers="true" images="true" artist="true"]
    [_track title="Ain't Misbehavin'" src="//s.w.org/images/core/3.9/AintMisbehavin.mp3" type="audio/mpeg" caption="" description="" image="" meta_artist="Louis Armstrong and His Orchestra" meta_album="78 RPMs and Cylinder Recordings" meta_genre="" meta_length_formatted="3:21" image_src="//s.w.org/images/core/3.9/louis.jpg" image_width="308" image_height="240" thumb_src="//s.w.org/images/core/3.9/louis.jpg" thumb_width="308" thumb_height="240"]
    [_track title="Buddy Bolden's Blues" src="//s.w.org/images/core/3.9/JellyRollMorton-BuddyBoldensBlues.mp3" type="audio/mpeg" caption="" description="" image="" meta_artist="Jelly Roll Morten" meta_album="78 RPMs and Cylinder Recordings" meta_genre="Jazz" meta_length_formatted="2:09"]
[/_playlist]

Example 1b

Here’s the playlist from example 1a, but with

tracknumbers="false" images="false"

Example 2

Here’s the vanilla version of the above audio playlist:

generated from the shortcode:

[_playlist type="audio" current="no" tracklist="yes" tracknumbers="no" images="no" artist="no"]
    [_track title="Davenport Blues" src="//s.w.org/images/core/3.9/DavenportBlues.mp3"]
    [_track title="Dixie Blues" src="//s.w.org/images/core/3.9/Louisiana_Five-Dixie_Blues-1919.mp3"]
[/_playlist]

Example 3

Here’s a video playlist:

from

[_playlist type="video"]
    [_track caption="Live widgets previews in WordPress 3.9" src="//s.w.org/images/core/3.9/widgets.mp4" image_src="/projects/wp-content/uploads/2014/04/widgets_screen.gif"]
[/_playlist]

Happy listening!

Changelog:

0.0.8 (2015-08-02)
– Fixed: Issue #7 by using true/false instead of 1/0 (Props: @X-PRESSIVE)

0.0.7 (2015-03-08)
– Added: New shortcodes [_playlist] and [_track].
– Deprecated: The support for the shortcodes [wpse_playlist] and [wpse_trac] will phase out.

0.0.6 (2015-03-07)
– Added: Support for the autoplay attribute.
– Added: Support for the GitHub Updater. (Probs: @BlaineMoore)
– Added: More info in the README.md file.
– Changed: Replaced filter_var() with wp_validate_boolean(), so we need WordPress 4.0+.
– Changed: Refactoring regarding late escaping.
– Fixed: Some minor adjustments.

0.0.5
– Fixed: added the missing script class to support WordPress 4.0 (Props: @ruLait)