After running WordPress for a couple weeks, I decided I ought to get my head around how the whole thing works. That meant digging through the code, checking out the data-model, building a new theme, and changing some functionality. The first two were rather straight-forward. There’s a lot going on in the code, but it’s not that difficult to follow, and the database is pretty easy to grok as well.
To build a new theme, I started with a copy of the default templates and a blank CSS file. I worked through each of the templates, tweaking a few things here and there to better match how I wanted to organize everything, then started rebuilding the layout using CSS. I’m pretty happy with it for now, although it does look a lot like my old site. The main thing I wanted to do with the new theme was to get rid of that fixed-width layout and use something that scales with the window. To help fuel the CSS layout ideas, I read through some of the examples on glish.com.
While changing the page layout I also wanted to take a stab at tweaking a little functionality. I decided to pick something easy and change the way categories are displayed. By default, categories are dumped into your templates as list items. But instead of displaying a list, I wanted to rip off of the flickr tag display style by adjusting font size based on the amount of content behind a link. Conveniently enough, WordPress allows plugins to bind to the ‘list_cats’method, so all it took was a simple plugin. However, like WordPress, plugins are written in PHP, which I haven’t touched in a few years… and going back to PHP from Python is painful. (It’s amazing how annoying ending lines in ‘;’is for me now. Why not end a line with an end-of-line character? It’s going to be there anyway. And ‘$’for variables — why? The compiler knows what’s a keyword and what isn’t.) Fortunately the documentation on php.net is top notch, so it didn’t take too long to dust off those synapses that used to think in PHP.
In giving credit where due, and because I’m bad at coming up with project names, I named the plugin ‘flickrfy_cats’. You can view the source online to see the ugly code the caffeine told me to type, or download it for your own use.