How To: Assign WordPress Posts to Specific Pages

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!

Definitions

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.).

The Fix

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

  1. 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)
  2. 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…
  3. 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:

    WordPress Page Links To plugin

    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!

  4. 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!

    WordPress Category Visibility Plugin

    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!

Conclusion

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 :)

4 thoughts on “How To: Assign WordPress Posts to Specific Pages”

  1. Hello r3dux,
    Would you help out the WordPress beginners in the world, with a tutorial? What you say you did by posting to different pages is fantastic! I’ve tried doing it a number of times and I’m not quite figuring out what I am doing wrong. I live in Chile, South America. Thank you, Michael

  2. r3dux,

    Awesome! I looked around the internet for quite a while. I thought, “I can’t be the only person that wants to do this.” Finally, I came to your site. It worked perfectly and it only took me about 1 minute to make it happen from start to finish.

  3. At first I was sceptical, but then, after taking 2 minutes to follow your step-by-step instructions, it all worked out exactly like I wanted.
    Thank you for taking the time to help out other users
    You are the bomb dot com

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">