Home > Article > CMS Tutorial > How to add MP3 player to WordPress blog
How to add MP3 player to WordPress blog?
First go to the home page of Flash MP3 Player to download the program. After decompression, place the two files mp3player.swf and ufo.js on the server, assuming they are placed under /musicplayer. (Note that Flash MP3 Player has a bug. The path name cannot contain the word mp3, otherwise the playlist cannot be read normally.)
Create mp3player.php in the current theme directory of WordPress with the following content.
Recommendation: "wordpress tutorial"
The code is as follows:
<p id="mp3player"><a href="http://www.macromedia.com/go/getflashplayer" target="_blank">下载 Flash Player</a>来播放音乐。</p> <script type="text/javascript"> var FU = { movie:"/musicplayer/mp3player.swf", width:"190", height:"20", majorversion:"7", build:"0", bgcolor:"#FFFFFF", flashvars:"file=/musicplayer/playlist.xml&showdigits=true&repeat=true&shuffle=false&lightcolor=0x0080FF &backcolor=0x0066AA&frontcolor=0xEEEEEE" }; }; UFO.create( FU, "mp3player"); </script>
Then add in the appropriate location of sidebar.php:
The code is as follows:
<?php include(TEMPLATEPATH . '/mp3player.php'); ?>
Add in header.php:
The code is as follows:
<script type="text/javascript" src="/musicplayer/ufo.js"></script>
Finally upload the mp3 file to the /musicplayer directory, It is best to name the file in English, and then create the playlist.xml file under /musicplayer.
The code is as follows:
<?xml version="1.0"?> <playlist version="1" xmlns="http://xspf.org/ns/0/"> <trackList> <track> <title>Music Title</title> <creator>Singer</creator> <location>/musicplayer/song.mp3</location> </track> </trackList> </playlist>
The effect is as shown below.
The above is the detailed content of How to add MP3 player to WordPress blog. For more information, please follow other related articles on the PHP Chinese website!