Template Tags

Tags have become easier since version 1.7, you can now send in shortcodes. Note: there's an admin option to ignore the tags which needs to remain unticked when you want to use them.

Instructions: Place tag (1) in the header, place tag (2) where you want the players to be.

(1). mp3j_addscripts( $style )

Loads the player's javascript and CSS files into the page header, and allows you to set a stylesheet. This tag must be placed above wp_head(), and must be used to ensure scripts will be loaded for players set via template tags.


(2). mp3j_put( $shortcodes )

Adds player(s) where the tag is placed in the theme. Can use multiple times.



Example

Play 5 random library tracks on the posts index page

Put this in header.php above wp_head()

<?php
   mp3j_addscripts(); 
 ?>

Put this in index.php

<?php 
   mp3j_put( '[mp3-jplayer tracks="FEED:LIB" pick="5"]' );
 ?>

Always use if ( function_exists() ) {} to check tags exist before running them incase the plugin gets deactivated.



The following tags are not necessary but can be used:

mp3j_grab_library( $format )

Returns an array of all the mp3's in the library with their 'filenames', 'urls', 'titles', 'excerpts', 'descriptions', and original ID (not attachment). Can be used anywhere.


mp3j_debug( $info )

Prints some info from the plugin to the browser's source view (CTRL+U or Page->view source) about the page that just ran. Can be useful for debugging when customising templates.



Depreciated tags

These tags have no use anymore, setting them has no effect.

mp3j_flag( $set )

mp3j_set_meta( $tracks, $captions )