is_single 是为了测试某个东西是否是一个帖子类型的模板。而且我认为帖子不能成为主页。页面本身可以在设置->阅读->首页中设置为首页...
你可以使用这些:
// check by page id
if (is_page(PAGENUM)){...}
//returns TRUE when the main blog page is being displayed and the
//Settings->Reading->Front page displays is set to "Your latest posts"
if (is_front_page()){...}
// Return TRUE if page type. Does not work inside The Loop
if (is_page(PAGENUM)){...}
// Checks if the post is a post type. Returns FALSE if its a page.
is_single()
因此,由于 !is_page('home') 将在 is_single() 上返回 TRUE
<?php
if (is_home()) { // do this on home page only
?>
<div id="grey-bar">
<h1><?php the_title(); ?></h1>
</div>
<?php }
?>
<?php
if (is_single()) { //displays this stuff if its a post type only
?>
<div id="different-bar">
<h1>BLOG</h1>
</div>
<?php }
?>