Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Making Your Blog Appear in a Non-Root Folder

Suppose you have WordPress running at http://example.com/. Also, suppose that you want your blog to be located at http://example.com/blog/ and that you want other pages to be available at http://example.com/page1/.

The first thing you will want to do is to create a homepage. You can do this by creating home.php in your theme directory. Next, create a blog template. The easiest way to do this is to create a file named blog.php with the following contents in your theme directory:

Note: the home.php file is not needed in versions 2.1+. Please see Creating A Static Front Page to learn about how to create separate blog and front pages.

Template Name: Blog

// Which page of the blog are we on?
$paged = get_query_var('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');

Log in to WordPress and create a page named "Blog" with Template "blog". You're done. The one last thing you will want to do is to update your permalinks structure to begin with "/blog/", i.e., "/blog/%year%/%monthnum%/%postname%/". Now you have a WordPress-managed CMS with a unique front page and logically-structured blog content.

If you're using the <!-- more --> quicktag to place things below the fold in your posts, you'll want to include the global variable $more and set it to zero (as shown in the code above). Otherwise, the entire post will print out on your blog's main page.