Home > CMS Tutorial > WordPress > body text

How to add MP3 player to WordPress blog

藏色散人
Release: 2019-12-28 09:36:36
Original
2584 people have browsed it

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>
Copy after login

Then add in the appropriate location of sidebar.php:

The code is as follows:

<?php include(TEMPLATEPATH . &#39;/mp3player.php&#39;); ?>
Copy after login

Add in header.php:

The code is as follows:

<script type="text/javascript" src="/musicplayer/ufo.js"></script>
Copy after login

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>
Copy after login

The effect is as shown below.

How to add MP3 player to WordPress blog

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template