As I said previously, the decision to move news to WordPress seems a straightforward one – it’s used by millions of websites to serve up News, including our own faculty and department websites – but our key justification for the migration, to provide story functionality, isn’t something that WordPress does out of the box so over the last few months we’ve developed something from scratch.
While I’d love to take credit for everything, my involvement was mostly limited to the initial proof of concept and vague arm-waving spec-changing suggestions for how it should work and look. Such is the power of a manager.
WordPress has come a long way since it’s blogging roots and now has some powerful features that can be used to tailor the system to a wide range information. Custom Post Types were first introduced in version 3.0 and provide a way of storing structured information without having to create additional database tables. WordPress itself uses CPT for posts, pages, attachments (e.g. images) and menus but the possibilities for extensions are endless. Plugins often make use of CPTs to implement things like events listings, movie reviews and product catalogues but anything can be put in them and you get all the functionality that WordPress posts or pages have for free.
We have a really basic Story custom post type containing – as a minimum – just a title, image and a paragraph introduction:
Stories and Posts are linked together with a many-to-many mapping using jQuery Tokeninput to make it easy to select which story a post should be related to.
Viewing a story triggers a custom template in our theme that is used to render the page. The template first displays the story title, image and content then looks for all linked posts and outputs them to the page, newest first.
We’ve tried to keep the Story custom post type simple enough that it can be used flexibly in lots of different ways. By specifying just a title, image and content, stories can work as a lightweight wrapper for related posts. They’re not designed to replace a full website – for example the Short Story Prize story still links to the Prize’s standalone website – but act as a focal point for the latest news on a subject.
WordPress mints permalinks from the title on initial publication and only change if forced to do so after that so links to stories will still work even if the introductory text changes.
Stories can work as a live blog by streamlining the process of getting content online – once a story is set up, say for something like a Graduation ceremony – it’s a simple matter of clicking Add Post to Story in the WordPress admin bar and bashing out a quick update, or pasting in a link to a video, tweet or photo:
Custom post types are the key to extending WordPress’ capabilities by managing structured content but there are other features that allow us to expose this information in new ways. Next time we’ll be looking at how our design is able to make the most of our rich media content.