Tweaking Your Theme

Using a Page as Your Posts Page in WordPress

December 29, 2008   ·   By   ·   1 Comment   ·   Posted in Tweaking Your Theme, Wordpress

About a year ago, I put together a website for a client – it was for a medium sized company who needed a mostly static CMS for their website.  They wanted to be able to edit all of their pages themselves, but they also wanted a blog style section for news items.

Naturally, I suggested WordPress for the job – I hadn’t done a huge amount of work with WordPress in the past, but just enough to know that if a client needed a CMS or any sort of blog, I wanted to use WordPress for the job.

So, I got the whole site put together – but It was a fairly complex theme, with dynamically generated dropdown menus, different backgrounds for each page, etc etc, so I didn’t spend much time worrying about the a few details until right before the project needed to be completed – namely, making a static page the home page, and using a normal page to list the blog posts.

When the time came to do so, I whipped up an entirely overcomplicated system in the theme to do this for me – I used WordPress conditional tags to display the static page I wanted on the home page, and I used a custom query with a matching loop on a page template to display blog posts on the static page I wanted to.  The whole thing took hours of researching, implementing, and testing, and at the end of the day, it had some very specific requirements to work properly.

Six or eight months later, on a different project, I had the same requirement – the client needed a static home page, but still wanted a blog on another page.  I started to build the same type of system, and then noticed an option on Settings->Reading:

picture-1

This is still a little confusing at first, so here’s a bit of explanation:

You’ve got 2 sets of options.  First, you need to chose what your front page displays – this is the radio button.  The default, obviously, is ‘Your Latest Posts’.  This works the way you’d expect it to work – the homepage shows your latest posts.

The second option, A static page, gives you some choices:

First, you need to choose your Front page -  the dropdown menu here will be populated with all the pages you currently have written.  The page chosen here will determine the page that shows up on your blog home page.

Second, you have the Posts page -  here, you can choose a page to display your posts – this one is a little trickier – when you visit this page, you’re going to see the list of most recent posts, as you normally would on the homepage (in your theme files, this will now call index.php).  On most themes, this is NOT going to display your page content as well.

One Comment

Submit a Comment