New project adds iCal feed to WordPress 3


I’ve been working with well known LibDem blogger Mark Pack, whose day job is with PR company Mandate, to migrate the website of the Cancer Campaigning Group over to WordPress. It’s a fairly modest little site, and I was under orders to keep the design broadly as-was. But it’s got one specific feature I’m very excited about.
Nearly four years ago, I wrote about the increasing adoption of the iCal standard for calendar sharing. With Outlook 2007 set to embrace the format, I foresaw a rush of websites publishing event data in iCal feeds, allowing you to subscribe with a single click, and then see someone else’s dates alongside your own.
The, ahem, optimistic assessment would be that I was well ahead of the curve. Four years on, you’ll struggle to find many (mainstream) sites offering such feeds – although I’ve noticed a slight increase of late. The BBC, for example, had a feed of World Cup fixtures; the Arsenal site has a similar service for its new fixture lists, including the Reserves, Youth and Ladies teams. Why? Maybe it’s the growing prevalence of smartphones by Apple and Google, both of whom were quick to adopt the format.
And then suddenly, the opportunity presented itself to build an iCal-enabled site of my own. The Cancer Campaigning Group’s previous site had an ‘events’ section, although it wasn’t anything special. WordPress 3.0, released just over a month ago, includes the ability to create ‘custom post types’; and I only recently discovered its little-documented ‘add_feed’ function, introduced as far back as early 2007. A little jQuery on the front- and back-ends, and we had all the ingredients we’d need.
So I’ve written some code to create a custom post type called ‘Event’, and added it into the WP back-end interface. You enter event details just as you would enter a post or page, with a title, body text and optional excerpt. There’s a special ‘event type’ categorisation; and a pop-up date picker for simplicity and consistency.

Then to call the calendar into a page, you use a WordPress shortcode – [calendar]. You can also specify the range (past or future), and the view (simple text list or javascript-enabled grid), plus the ‘type’ (if you’re using them). This actually gives you remarkable flexibility, only some of which is obvious on the Cancer Campaigning Group site.
And of course – there’s the iCal feed. If you take the feed URL into your calendar app of choice, you should be able to subscribe to it. And then, as the site admin adds new events, these will simply appear alongside your own personal appointments.
It hasn’t been easy: and to be honest, I’m not entirely confident that we’ve captured and resolved all possible issues. The biggest problem has actually been with Google Calendar: Google caches the feeds for an indeterminate period, and there’s no apparent way to force a refresh. So if there’s an issue with your code, you may not realise for several hours; and it may take a further few hours for your fix to feed through. I’m also fairly sure that the code, as it currently stands, won’t scale too well.
So for now, I’m watching the Cancer Campaigning Group site to see what happens. If it goes OK, I’ve got a couple of much higher-profile clients waiting in the wings.

Cracking calendars

When you think about it, the progress in online calendaring (if there is such a word?) has been one of the web’s bigger disappointments. It’s not for a lack of ideas, services (Google, 30Boxes) or standards (iCal)… maybe it just isn’t sexy enough compared to Flash-ier functionality. But things are finally moving, it seems.
I’m starting to see sites waking up to the potential of offering date-based information in date-based formats. This morning, for example, I added the next few televised Arsenal games into my calendar, thanks to the Arsenal fixture list‘s one-click links to .ics files. And I added details of the train I’m catching shortly, thanks to the new iCalendar links on the fantastic traintimes.org.uk site. Very simple, very straightforward, but a huge step forward in terms of convenience.
And hurrah! – it looks like decent calendaring is finally coming to WordPress. An already pretty good plugin by Kieran O’Shea is set for a major update, with all sorts of powerful new features.
I’m also working with a (very!) high-profile client on a closed-community website, and it’s looking like date-based information could be the site’s ‘killer app’. We’re exploring the possibilities of tying a personalised ‘to-do list’ into a calendar presentation of key dates, so (for example) each task’s deadline appears automatically in your calendar (until it’s completed).
For added convenience, we’re talking about offering a downloadable AIR-based desktop widget / client / thing, which could also include the latest news items from the site (via RSS). An already interesting project is now getting very exciting indeed.