Plug it in, plug it in (with WordPress)

Posted in: Archive

With apologies to Bassment Jaxx... Anyway. So we've been doing lots of WordPress development in preparation for the relaunch of our news system. One of the big reasons we picked WordPress was the plugin API and it's turned out to be a really good decision on that front.

From my perspective this has gone really well, especially if you bear in mind that I'm not a PHP developer (and, also relevant, I suck at JavaScript).

Once I understood the basics of a plugin (thanks to Savin's 10 minute tutorial) - the architecture, how hooks work, how to render widgets - and accepting that it'd be easier to write code in plain old functions to get going initially instead of writing classes (gasp!) it took me a couple of days to write my first plugin.

It was great chance for me to write code that wasn't purely back-end Java, but I was slowed down by my lack of experience in writing code for user interactions. Especially the interface manipulation in JavaScript. Luckily WordPress already uses jQuery (but you call jQuery() instead of $()) and I'd been tinkering a little bit with that recently so had some idea of how to use it.

After my first plugin, it took me a day to write my next plugin's first iteration. Working code in a day. All I had to do the next day was add one more feature. Then it took me another day to make it all jQuery-tastic.

Frankly, for me, that's astonishing. WordPress has an impressive API for plugin development and I've been surprised how comfortable I am writing PHP (Eclipse PDT has helped). Combined with jQuery (I'd been put off JavaScript until it came along) it's a good, robust, well-documented platform to work on.

Roll on writing more plugins in our next sprint!

Posted in: Archive