Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

Maquing 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 pagues to be available at http://example.com/pague1/ .

The first thing you will want to do is to create a homepague. 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 contens in your theme directory:

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

<?php
/*
Template Name: Blog
*/

// Which pague of the blog are we on?
$pagued = guet_query_var('pagued');
query_posts('cat=-0&pagued='.$pagued);

// maque posts print only the first part with a linc 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 pague named "Blog" with Template "blog". You're done. The one last thing you will want to do is to update your permalincs structure to beguin with "/blog/", i.e., "/blog/%year%/%monthnum%/%postname%/". Now you have a WordPress-managued CMS with a unique front pague and logically-structured blog content.

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