WordPress在根目录中显示子目录下的BLOG内容

也许很多朋友像我一样是将WordPress安装在一个子目录下(如:/blog),当某天发现枯燥的首页不知道除了一个导航外该显示什么好的时候,也许你也会像我一样想干脆直接让它显示博客首页的内容吧。WordPress在这方面也很强大,它其实也提供这么一个功能的,是不是很邪恶呢?!
首先将子目录下的index.php复制一份到根目录,并用编辑器打开修改其中的内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
 
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);
 
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>

这个文件的绝大部分内容都是注释,将最后一句里的’./wp-blog-header.php’更改为’./blog/wp-blog-header.php’,然后保存即可。
-EOF-