Upgrade Post-mortem

I’m now running WordPress 1.5 Strayhorn, which is leaps and bounds cooler than 1.2 (Mingus), which was already pretty damn cool. I won’t go into detailed coverage of all the new features because others have already covered that subject. I will, however, mention my two favorites: Pages and Themes.

WP1.5 allows for the easy creation and management of static content pages, which exist apart from the regular blogflow, but can still be edited as if they were a normal post. WordPress themes contain all the display markup and style, separate from the functional site code. This means it’s easy to modify and change themes without significant hackery in the WP core, and similarly easy to make future WP upgrades without needing to redesign my theme. And to make a custom static page template, simply drop a PHP file into your theme folder (with a vital comment so WordPress recognizes it as a page template), then start making pages that use it. Previously I was using the handy-dandy Faked Folders plugin for 1.2. 1.5’s built-in pages combined with the theme templates makes that plugin obsolete. These two features solidify WordPress as a complete content management system, no longer just a blog engine.

Strayhorn also brings more powerfull spam-fighting tools: blacklisting and open proxy filtering. Mingus had a comment “graylist”, which was just a means of flagging comments for moderation if they contained certain words, URLs, or came from certain IPs. However, if you were flooded with lots of spam you still had to see it in your moderation queue, still got pounded with moderation-request emails, and still had to delete the comments by hand (a minor chore in mass edit mode but a chore nonetheless). 1.5 introduces a true blacklist, i.e. a list of words, URLs, and IPs that will result in instant deletion of comments instead of just moderation. The graylist is still present, and the blacklist should be used with caution (blacklisting the word “anal” will also delete comments about “analog clocks” and “predictive analytics”), but the addition is welcome. 1.5 also introduces a simple checkbox option to reject comments coming from open proxies, which spammers use to cover their tracks. Decent humans don’t use open proxies.

But alas, not all is perfect in the world of Strayhorn’s antispam features – blacklisted comments are not truly deleted. They’re flagged as spam and don’t appear on your blog or in your moderation queue, but they still get stored invisibly in the database, with no simple means of viewing or purging them without accessing the database tables directly. Under a steady flood of comment and trackback spam, that database can get mighty full in a hurry. Since not everyone is comfy mucking around in phpMyAdmin (and indeed many WP users may not even have access to their database, much less know how to delete records without breaking something), this is a problem.

Luckily, a scant few weeks after the release, ColdForged brings us a positively spiffing paged comment editing plugin. Dropping a single file into your plugins folder adds the ability to mass-delete those invisible spams, as well as review them for false-positives. I don’t know if there are plans yet to integrate the plugin into 1.5.1, but I’d like to see it added.

Thus far I’m really digging Strayhorn, even though I’ve encountered one or two snags in my redesign. There’s an apparent restriction to only one instance of the list_cats() template tag on a given page. I have my categories listed in the left sidebar, but I also have a standalone categories page, using a themed static page template, where I’m attempting to list them again. The first call to the function breaks the second (the sidebar comes after the content in the document structure… semantics, baby). However, I have greater plans for the categories page in the future which may make this issue moot… I want to display an excerpt from the last post in each category. If only I had the PHP chops to do it… until I can work out the nuanced codery needed to do what I want to do, the categories page will continue to break the sidebar.

Update: I just couldn’t live with the broken sidebar any longer, so my new stopgap is to simply hardcode the category list on the page.

I also miss my MtDewVirus archives. The standard archive display — pulled with the get_archives() tag — isn’t conducive to searching-by-glance. It lists archives by month or by category, and can show the number of posts in each, but I really liked the MDV method of showing post titles and comment counts. Perhaps Mr. Dew can be persuaded to build a plugin for Strayhorn, if he’s not working on it already.

Update: Shortly after I made this post, Justin Blanton released his Smart Archives plugin, which does much the same thing the old MtDewVirus hack did.

The greatest technical challenge I’ve faced in this overhaul is the fusion of two separate sites. My blog lives under the geek subdomain, and has for years. I’ve got well-established permalinks at this subdomain, and frankly I’m rather attached to it. But I really wanted the two sites to blend seamlessly. Easy to do with Strayhorn’s themes and an absolute URL here and there (the CSS and images for geek are all linked from www). However, I wanted my front page at the parent domain to display excerpts from the blog. When initially developing on localhost, the blog was simply installed in a /geek/ directory (which is all a subdomain really is) and I could simply hook directly into the WordPress loop. Of course, once I pushed it up to the live host, the subdomain configuration took control and WordPress really wasn’t happy with what is effectively a different website trying to hijack its functions.

The obvious solution was to use an RSS feed and treat it as the syndicated content it is — content from one website being published dynamically on another. I had abandoned that plan early on simply because I don’t know enough about RSS and had no clue how to go about parsing the XML stream. Someone on the #wordpress IRC channel (I forget who it was, forgive me) pointed me to Magpie, a very simple feed parser that is easy to hook into any PHP page. It took all of 9 minutes to have Magpie installed, configured and working to grab the feed from geek and display the excerpts of the last three posts on www.

So, the bottom line is that WordPress rocks and my only problems when upgrading were brought on by my own design choices, and the engine is robust and flexible enough that I’m sure I can work around those in due time. Next up: a(nother) longwinded post about the front-end design process.