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.

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.   If you are using WordPress 2.5 or newer, please keep this in mind if you try this.

Kyle Eslick is WordPress enthusiast who took his passion for WordPress to the next level in 2007 by launching WPHacks.com as a place to share hacks, tutorials, etc. Follow Kyle on Twitter @KyleEslick!

  1. Tudor says:

    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.

  2. Kyle Eslick says:

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

  3. Tudor says:

    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!

  4. Matthijs says:

    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.

  5. Dan says:

    I’ve managed to recreate Tudor’s problem on my 2.5 test install. Looks like this might be a 2.5 bug.

  6. Brian Ward says:

    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/

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

  8. Dan says:

    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.

  9. Kyle Eslick says:

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

  10. graphic art says:

    mine didnt work at all…it show the 404 error/page not found. im using wordpres 2.6

  11. vafa says:

    see my news website
    powered by one installation of wordpress for contact (/cms)and one for planet (/palnet)
    with 8 layout
    4 layout for category(video, images, text, spire)
    4 layout for pages(links, ads, static pages, spire)
    1 for home
    1 for single

  12. Aerotheme.com says:

    I always thought that WP is more like a CMS than a blogging engine.

  13. scvinodkumar says:

    i have created a recommend.php page and placed under the active theme. Now, I dont know how to call this file in browser, please tell me…

Trackbacks/Pingbacks »

  1. 100+ Killer Wordpress Resources | Steffan Antonas' Blog says:
  2. links for 2008-10-09 - iKeif - tech and social media geek, mootools fan, and a ton of links - iKeif - tech and social media geek, mootools fan, and a ton of links says:
  3. How To: Tell WordPress To Function Like a CMS | Mattie’s Blog says:
  4. 10 Extremely Useful WordPress Hacks And Tips | Tweeaks Design says: