So, you have an established WordPress blog, but you’ve seen the pro bloggers doing it and now you want to turn that blog into a Content Management System (CMS)? Many people probably weren’t aware of this trick (including many web developers), but one neat feature added with WordPress 2.1 was the ability to have a different home and blog page without needing to install WordPress on a completely new directory.
In order to accomplish this, you first need to make sure that the page that you want to be your blog’s homepage is named home.php. This will be the page displayed at the root of your domain.
Next, you’ll want to create a new file named blog.php and place the following code within the file:
<?php
/*
Template Name: Blog
*/
// Which page of the blog are we on?
$paged = get_query_var('paged');
query_posts('cat=-0&paged='.$paged);
// make posts print only the first part with a link to rest of the post.
global $more;
$more = 0;
//load index to show blog
load_template(TEMPLATEPATH . '/index.php');
?>
That is all you need for code in that file. Upload it to your theme. This code creates a loop of your index.php file in your theme (commonly used as the single post page) and displays it as a typical blog homepage. Because this page will pull from your index.php file, going forward, any changes you make to your index.php file will update on this page as well.
Now, go into your dashboard and create a new page called Blog. Then select the Blog file you just created in the Page Template drop-down menu in the right sidebar.
Once that is done, the last thing you need to do is go over to your permalink structure page (under Manage) and add /blog/ to your custom permalink structure. This means if you are using an optimal permalink structure, you would want to use a custom structure of /blog/%postname%/. If you are doing this to an established blog, you can easily use the Permalink Redirect plugin to redirect your old permalink structure to the new one.
To see this in action, you can check out my personal blog, Kyle Eslick dot com. If you have any questions, feel free to post them below and I’ll do my best to answer them.
Edit: This was written for WordPress 2.1 through WordPress 2.3.3. It appears that a slight adjustment has been made for WordPress 2.5+. Readers have confirmed that you can find the information you for a WordPress 2.5+ install in this post.












Sunday, March 30th, 2008 at 5:27 pm
hello.
i’ve been using exactly what you’ve described for a while, but after updating to 2.5 this seems to be broken. the blog page stays under blog, so do individual posts (blog/postname), however paged archives /blog/page/2 return a 404. if i remove the /blog by hand and only leave the /page/2 part, it seems to work. also, child pages of my blog page (blog/archives) return a 404.
do you have any ideas? i’ve raised this issue on the alpha/beta wordpress forum but no one seems to reply, so any help would be greatly appreciated.
tudor.
Sunday, March 30th, 2008 at 7:21 pm
@ Tudor - This post was written last week, prior to WordPress 2.5 being released. With that said, after reading your post, I checked it out on my other site and everything seems to be working fine.
Let me know what response you get on the forums. In the meantime, I’ll look into it a little more.
Sunday, March 30th, 2008 at 8:32 pm
it’s really strange, i deactivated all the plugins and it still does the same thing. i just can’t think of what could be wrong. i don’t think i’ll get a reply from the forums, i had posted the issue a while ago when RC1 came out and I ended switching to 2.3.3. because i didn’t get a reply since then.
thanks for any kind of help!
Monday, March 31st, 2008 at 2:11 am
It seems like a good tip. But I wonder what the exact reason is that you need a new, separate blog template. When you just
- create a home.php template with all the code needed for the home page, and then
- create a page for your home and let that page use the template home.php you created
- then in settings check the option to use a static page for your homepage and pick the page you want
Now you have a separate “static” custom home page, while the “dynamic” blog section uses the normal templates (index, archives, single, etc). No need to create a separate blog template.
Friday, April 4th, 2008 at 8:46 am
I’ve managed to recreate Tudor’s problem on my 2.5 test install. Looks like this might be a 2.5 bug.
Friday, April 11th, 2008 at 2:41 am
I actually had been looking for a solution to this problem the other day. Unfortunately I didn’t find your post and had to come up with my own solution. I’ve documented it as follows:
http://www.brianward.us/tech/2008/04/10/creating-a-dynamic-wordpress-homepage/
Wednesday, April 23rd, 2008 at 6:59 am
I have the same Problem like Tudor and i can’t figure out what is wrong with the permalinkstructure.. Brian Wards Guide dont gets me further as well.
Wednesday, April 23rd, 2008 at 7:20 am
I emailed Tudor to see if he ever fixed his problem. He directed me to this: http://trac.wordpress.org/ticket/6603
I’ve tested and can confirm that this works. It’s a really simple tweak to make.
Wednesday, April 23rd, 2008 at 10:20 am
@ Dan - Thanks for the heads up on this! I have updated the post with the link you provided for WordPress 2.5. I figured that was best, rather than change the post and then have people on WordPress 2.3.3 or under have problems.
Thursday, April 24th, 2008 at 5:05 am
Thank you very much Dan, i have translated the core-hot-fix to German at
http://www.seraph-design.de/blog/allgemein/wordpress-hack-fur-statische-homepages-mit-alternativen-permalinks/