Originally for my own use, I put together a couple of WordPress plugins, which I thought I’d make available in case they were useful to anyone else.
Google AdSense shortcode
This is the simplest plugin, which provides an ‘adsense’ shortcode to output a Google ad. To use it, use Google’s tools to create the ad, then paste it into the php file where indicated, then put {adsense} (replace the curly braces with square brackets) in posts/pages where you want the ad to appear (remove the spaces around the square brackets).
And now for a demo + shameless attempt at monetization:
Media player
This one is useful if you occasionally post a video file on your blog, and host it locally. If you use video more frequently, there are plugins that probably are more suited, but I personally didn’t want the overhead, and I wanted to store videos in the standard upload locations, instead of having a separate repository, which seems to be what other plugins do.
This one uses the JW FLV player, provided in the plugin. Use something like:
{media source="http://my.site.com/path/to/video.flv" width="400" height="308" preview="http://my.site.com/path/to/preview.jpg"}
(replace the curly braces with square brackets)
I used this just the other day on a post demonstrating the output of the simulator I’ve written for my PhD.
Music player
This is the plugin that renders the content for my music page, as well as providing mini-players for other posts. Give it a path to a directory, and it will display all mp3 files in that directory with flash players based on the XSPF Web Music Player. Recently-added mp3 files will be marked as ‘New’. Use something like:
{musiclist path="path/to/my/music"}
(replace the curly braces with square brackets; add optional nolink=”true” parameter to avoid linking to the mp3 files from their titles)
For just one track, use:
{audio source="path/to/audio.mp3"}
G’Day Michael,
I love this theme! And thank you for fixing the footer and the “submit.” I was just reading your posts above. I’ve been wondering how to add Adsense and video – perfect!
Thank you again!
Ted
Nice plugins. Thanks Michael!
hi michael! tnx for plugins, i’ve tried to post adsense in single post directly in code but its not working either with your plugin either with google adsense…
before i updated theme, i just added at the end of single post editor the code, and it had worked out normally… can you help me solve the ussue… tnx… d.
Hiya, I’ll need a few more details, there – What do you mean by ‘not working’? It’s not showing up, or giving an error? Showing up incorrectly? Swallowed your cat?
Do you have a link with an example of this happening?
yep! first it swallowed my cat then i got chewed adsense… kinda shortened… ;)
it’s ok, michael… i decided to let it go, and then it started to work :)
stay cool and sorry for long reply…
best, d.
cool template
nice template thank
hello Michael im having some issues trying to make music player work on this theme i've installed locally on my pc..
on music page im using smt like this: [musiclist path=”http://localhost/wordpress/wp-content/uploads/mp3”]
im then getting this error:
Warning: opendir(”http://localhost/wordpress/wp-content/uploads/mp3/”) [function.opendir]: failed to open dir: No such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\musicplayer\musicplayer.php on line 22 dont know what else i should do. i ve installed music player plugin and put this code to music page thank you..
hi michael! i installed plugin locally on my pc as well as grunge theme.. on my music page im using this path to music folder: [musiclist path=”http://localhost/wordpress/wp-content/uploads/mp3/”]
but im getting error: …No such file or directory in C:\xampp\htdocs\wordpress\wp-content\plugins\musicplayer\musicplayer.php on line 22
please tell me what im doing wrong? thx!
Hi, Mario. Unless I'm missing some other details, the problem's written right there – the directory doesn't exist. You need to specify a path, not a URL, then make a directory there and put some mp3 files into it.
Try [musiclist path=”/wp-content/uploads/mp3/”] instead