I now have audio!
This is actually a plugin (the WordPress Audio Player, which only a few days ago came out with what I hear was a much-needed update), which is something WordPress does really well (plugins, that is). Finding, installing, and activating plugins is never more than a few convenient clicks away. But of course, as has been my luck with this theme so far, it wasn’t as easy as that for me.
After installing and activating, I uploaded the above mp3 via FTP* and created a new post with the suggested insertion format. I got a big fat error saying:
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.
Flash is up-to-date and JS is enabled, so that wasn’t the problem. Being that this is a fairly common error message to get with this plugin, I was able to find a lot of support in the WP forums. Many people suggested adding <?php wp_head(); ?>
to the head section of the blog. This somehow triggers the plugin or something, and it fixed the problem for most people. After adding it, a bunch of new code appeared in the head section of my source code, so I was hopeful that this solved it.
It didn’t. Same error kept coming up.
And since it fixed the problem for most people, there was little support beyond that in the forums. I downloaded another audio player that simply loads the WP Audio Player when you click on a link, and it had no problems. Obviously it wasn’t a problem with my browser, Flash, or even my blog. There was a problem with how the plugin was communicating with the theme (it actually worked just fine when I switched to the WordPress default theme). Though most complicated PHP is over my head, I was forced to dive into the plugin’s main file ([PLUGIN DIR]/audio-player/audio-player.php) to see if I could spot where the error was being triggered.
Miraculously, I was able to decipher enough to figure out that the plugin was trying to add a small snippet of code to the page’s footer. A light bulb went off when I saw that. While doing research on what the wp_head() function does, I noticed somewhere that there was an equivalent wp_footer() function. I put that into my footer.php file right before the </body>
tag, and what do you know? I now have audio.
Slowly but surely this blog is coming together.
*WordPress also has a really simple media-upload tool built in which I would have used, but naturally I ran into roadblocks with it as well. My server allows max upload sizes of 2MB by default, and after some research I was told to edit my php.ini file. Using HostMonster’s PHP Config tool, I created a new default php.ini file and edited it accordingly. It didn’t work. I don’t know if I just have to wait for the changes to take effect or if it just didn’t work. I guess I’ll try this if I still can’t upload bigger files by tomorrow.
UPDATE: I just uploaded a 6MB song, so apparently editing the php.ini file worked.