WordPress is a really nice WCMS and I’ve been really happy with it ever since I first migrated over back in February ’09, but it definitely has some limitations with regard to how you can structure your site.
Let’s take an example: Joe Blow has a site on hunting, camping and fishing – he writes regular articles on each of these specific categories, and he wants these posts to turn up either just in the specific Hunting/Camping/Fishing pages he’s created, or he wants them to turn up on the home page and also in the category specific pages.
I came up against this problem when I wanted to import a bunch of articles from back when I ran r3dux.org on PHP-Nuke – I didn’t want the “new” (i.e. imported from Nuke) posts cluttering up the home page of the site, I wasn’t going to run the old Nuke portal because it’s full of deprecated code & security flaws – but I wanted the old posts added and available from an “Old Site” page which I could put in the header – so how do we go about this? Easily – via a couple of useful plugins!
Before we continue, it’s worth spelling out exactly how WordPress defines Posts, Pages and Categories so we don’t get our terminology all mixed up and make things harder than they have to be:
- A Post is a single article entry, with at least one category (even if that category is the “uncategorised” category!) and may optionally contain some some tags which are keywords for the article.
- A Page is a static, single post which can be easily be linked into the header of your site. It does not contain other posts – it is simply a single post with a special tag that makes it easy to link in the header, and is commonly used to put information about the website author, FAQs, contact pages etc.
- A Category is a database field associated with an article to categorise it, such “Hunting”, “Fishing”, “Humour”, “Politics” etc. You usually set up a bunch of categories, and then select one or more of them to categorise your article, so for a funny joke about fishing, you might have the post categorised with both the “Fishing” and “Humour” categories, and you can then select to view all posts which are classified as this category or that category in a single page (or all posts of some category, showing 5/10/20 posts at a time etc.).
This is all well and good – but it’s this static, single post nature of Pages that what’s so unintuitive and can easily trip us up – we can’t link to categories from a page (well, you can, but you have to link from inside the static page, and then you just get a list of article links – which sucks), so we need something to be able to do that for us – and this is where the plugins come in. Specifically we’re going to be using:
- Mark Jaquith’s Page Links To plugin, and
- The RYO Category Visibility plugin [optional – get the beta version from the bottom of the post to use with WordPress 3.01 and higher!]
In combination these two plugins will set a page (i.e. header link) so that instead of it going to a single static “Page”, it instead links to a category list of posts of a given category, and (if you want to) additionally stop posts assigned to specific category from turning up on the main “home” page…
Installing and Configuring
- Go to both of the above links and download the WordPress plugin .zip file from each (you don’t need the category visibility plugin if you don’t want to hide posts from the main “home” page)
- Log in to your WordPress dashboard and click on the Plugins link in the left administration bar, then click the Add New button at the top and point it at a plugin .zip file and click upload. Once it’s uploaded and installed, don’t forget to activate each plugin. Do both plugins if you want them…
- To use the Page Links To plugin you just create a new page (or edit an existing one) and right at the bottom of the WordPress page where you enter the “Page” details, you’ll see this section:
You can fill in the URL to be anything you like, so in my case I’m linking to a list of all posts in the “Old-Site” category – you can link any category or specific post on your site, or link to http://www.google.com or http://news.bbc.co.uk – it’s entirely up to you!
- Next, if you want to hide posts from the main page, go back to the Dashboard and look for the RYO Plugins button right at the bottom on the left (underneath Settings) and click it!
From here you can see the list of categories along with their numeric IDs, and you can see that I’ve unticked the boxes on the Old-Site category for the Front and Feed options – which will ensure that any posts I put under the category Old-Site don’t appear on my home page or in the RSS Feed!
WordPress can be a little counter-intuitive and inflexible on its own, but because of its fantastic plugin architecture, and due to the great work of so many plugin authors, you have an incredible range of tools and techniques at your disposal to make your site work the way you want it to! So if you want to put posts about Gaming or Music or Films or anything into its own page, you can work around the architecture and get it done with just a couple of clicks. Good stuff :)