Advertising sustains the DA. Ads are hidden for members. Join today

Custom code

Last updated on
30 April 2025

You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules

<?php
/**
 * Custom MP3 Player theme function.
 *
 * @param theme
 *    Always set to 'mp3player'.
 * @param player
 *    The name of the player you want to use (default is 'Default').
 * @param url
 *    The URL to the mp3 file.
 * @param album (optional)
 *    The name of the album.
 * @param artist (optional)
 *    The name of the artist.
 * @param description (optional)
 *    A description of the mp3.
 * @return A WordPress Audio Player instance.
 */
theme($theme, $player, $url, $album, $artist, $description);
?>

Two examples:

<?php
print theme('mp3player', 'Default', 'http://www.example.com/audiofile.mp3', 'An example file', 'John Smith', 'An optional description of the file');
?>

Or if your MP3 file has embedded ID3 data:

<?php
print theme('mp3player', 'Default', 'http://www.example.com/audiofile.mp3', NULL, NULL, 'An optional description of the file');
?>

Help improve this page

Page status: Not set

You can: