I was asked by a client to add some background music to a WordPress site, this is my quick how to.
That Mall Shopping Experience
The site in question was using WordPress as a CMS rather than a blog, the site is an e-commerce site selling designer jewelry, so I guess the browsing and shopping experience can be improved by adding music.
Real Music Not Musak
It also helps that the site owner is also a musician and has their own stash of quality and unique tracks to play over the top of the site.
Adding A Command To The Header
Here’s the nitty gritty on how I plan to add the music file and have it play when the site is opened. Â You need to add a command to your themes header file.
Depending upon your chosen theme you will have to either edit your themes header.php file, or if you have a funky new theme like headway or Thesis add this to the header script section.
I recommend you add it just before the </head>
command.
The code you need to add is:
<embed src=”YOURMUSCICFILE” autostart=”true” loop=”true” hidden=”true” ></embed>
I used this method instead of one of the many available media players because the site owner did not request a player control to be visible.
A Word Of Warning
Music is a very subjective thing, adding your latest death metal recording to a personal development blog may not be the best thing.
Give people an option to stop what they see as a cacophony, the option above does not supply that.
Music files will consume bandwidth like a group of sturdy Americans at and all you can eat Las Vegas buffet, be wary of this and look to your hosting provider before adding music.
Wrap Up
Adding music to a WordPress site may be great for your blog if it matches your audience, why not give it a try, now where is my MP3 of Billy Ray Cyrus; Achey Breaky Heart.