Beginner’s Help – Shortcodes

In WordPress, shortcodes are special words wrapped in square brackets. For example the word ‘audio’ is recognised by WordPress and MP3-jPlayer, and when you put it inside square brackets in one of your posts or pages it has a special meaning.

[audio]

When you use the shortcode above, it gets removed and replaced with an audio player on your site (in this case one that will playlist all the audio you’ve attached to the page).

Shortcodes are the main way of adding extra functionality into your site pages, and most plugins will register their own special words which you can then use as shortcodes within your pages. Sometimes you may use one of the built-in buttons WordPress gives you for adding the special content, say for example adding a playlist, however the end result is that a shortcode is added into your content for you.

When using MP3-jPlayer the 3 main shortcodes you can write, or that may get added for you are:

[audio] For playing single audio files (sometimes playlists)
[playlist] For playing playlists
[popout] For making a button that launches a popout player

 

Parameters

On their own these shortcodes are of limited use, as mentioned above they’ll perform a default task for you, so just putting [audio] in your page will add a player if you have attached audio to your page (attaching is a WordPress feature, see you Media Library list). So to make them more useful you can add commands (called parameters) into them.

With these shortcodes the most basic parameter is tracks, it’s the list of audio files or urls that you want to play. For example here’s a simple shortcode that you can copy and paste into one of your pages, make sure to copy the entire shortcode including the square brackets:

[audio tracks="http://sjward.org/seven.mp3"]

It will add this player for you

seven     

Please see the Demo Pages for more shortcode examples, and the Shortcode Reference for a complete list of the parameters that you can use within them.



Posted in Help Articles.