Do you use Martin Laine’s Audio Player Plugin on your WordPress blog? It’s a great tool. However, I discovered a limitation that prevented me from easily adding the audio player to a sidebar widget. So, I read up on how to write a simple plugin and after a few false starts, I came up with a WordPress Widget that, if you have the audio-player plugin installed for your WordPress blog, lets you embed an audio player anywhere there’s a sidebar space for it.
Note: The audio-player plugin supports the ability to directly insert an audio player by editing the PHP code. However, this requires editing your WordPress theme- something not everyone is comfortable doing. Also, it’s a pain to change the files, whereas with a plugin like this you can simply change files using the WordPress administration interface.
Getting the Plugin
You can get the plugin at the WordPress Plugin Directory here: http://wordpress.org/extend/plugins/audio-player-widget/. The best way to get it is via the WordPress plugin search, which handles installing and updating it automatically.
The AudioPlayer Widget is in version 0.1, is very simple and has very few options. You drag it to your sidebar and fill out the two text fields. The first is the label, the second is the URL to the audio file you want to display a player for.
If the audio-player plugin isn’t available, the label will be rendered but not the audio player tag. Also, no checking is done to verify that the URL is valid, etc.
It’s that easy. When the widget is rendered, it generates the audio player tag dynamically and you get a nice audio player in your sidebar widget.
Currently there’s no support for localization or any display other than a label directly above the player. It should play nicely with most themes. Please let me know if you run into any problems with it.
To see the plugin in action, you can visit my “commercial” site at http://voxman.net.
Credits and Acknowledgements
Thanks to Justin Tadlock for his tutorial on creating WordPress widgets. I used the sample widget he posted to learn how to make one, and used much of the sample code (heavily modified, of course) to create this one.