WP Biographia Is But A Quarter Of The Way To WP Mappa

In a way, this was all Matt Whatsit‘s fault; he writes very profane and very funny blog posts and reading his recent The Five Stages Of P****d Wife¬†(which you should read if you haven’t already, err, read it) made me laugh, hell, it made me ROFL and LMAO at the same time but it also made me think, though not necessarily about wives or drunkenness …

Now background reading and general swotting up on a topic is all very well but to really learn how to do something you just have to roll your sleeves up and do it yourself. Though it’s probably stretching a comparison too far, you don’t learn to drive a car through reading the highway code; you actually get behind the wheel (preferably under supervision) and … drive. You don’t learn about what food tastes good from a recipe book; you … taste the stuff yourself.

And so it is with writing code and using new and unfamiliar APIs. It was definitely the case with my recent (reacquaintance of, and) foray into JavaScript and the addition of support for Nokia’s Ovi Maps API to the Mapstraction project, with the added benefit of having to teach myself how to move from my (by now very dated) knowledge of version and revision control under CVS to git.

May the source code be with you

So, first JavaScript and Mapstraction and the Nokia Maps API and now to PHP and the WordPress API. There’s a lot of WordPress plugins that do geo-related stuff with your blog but none of them actually do what I want. WP Geo comes close, but it uses Google Maps and Google Maps only. Now I have nothing against Google Maps or the Google Maps APIs but I want maps from the company I work for on my blog.

When I came to add Nokia’s Maps API to Mapstraction I at least had a head start. I’d done some JavaScript and I was at least familiar with the Mapstraction API. But writing a WordPress plugin was another thing entirely. Despite hosting my blog on WordPress since 2004 and being able to hack a moderate amount of PHP, I’d never needed to use the WordPress API. Until now.

Bearing in mind the old adage about walking before you can run I decided the best way to tackle this was to write a WordPress plugin for something much more simplistic and this is where Matt Whatsit comes in. At the foot of each post is a nice little biography; in Matt’s case it read “Stole some Chewits in 1979. The guilt still haunts me“.

So I searched for a plugin that would give me this capability. There’s lots. But as with the desire for a geo-related plugin, none of them did exactly what I wanted. The closest I could find was Jon Bishop’s WP About Author plugin. So, as all WordPress plugins are licensed under the version 2 of the GNU Public License, I took Jon’s plugin and hacked it to do what I wanted it to do. The result is what I’ve called WP Biographia and you should be able to see the results of it at the foot of this post, if you’re reading it from this URL.

 

I now know, or at least understand at a conceptual level with much web searching of the WordPress Codex, how to write and structure a WordPress plugin. I still need to know how to write and structure a WordPress widget but that will form part of the next version of WP Biographia. By then, I should be armed with enough WordPress API knowledge to start to write what I really wanted to write, which is my geo-related plugin, which may, or may not be called WP Mappa. I’m only a quarter of the way there, but it’s a quarter more than when I started this.

In the meantime, WP Biographia is now part of the official WordPress plugin repository and is also up on github as well. It also now has a resident page here on my blog which I’ll update as and when I make sufficient changes and improvements to warrant a new version.

Starting to code again is addictive and I seem to have managed to rack up a few github repositories of recent. WP Biographia is but one of what I’ve christened, in line with the theme of Gary’s Bloggage, Gary’s Codeage. For now, it’s a holding pen for those code projects that live in github but for which I’ve yet to write a formal page on. These may appear sometime in the not too distant future as and when time permits.

Photo Credits: ficek1618 on Flickr.
Written and posted from home (51.427051, -0.333344)

Comments are closed.