First check the blogs related things like author, tag, post type
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == \'post\') ) ? true : false ;
}
现在检查并返回您想要的东西
function check_post_type(){
$postType;
if (is_blog())
{
$postType = \'I am post\';
} else
{
$postType = \'I am page\';
};
return $postType;
}
像老板一样使用它
<?php echo check_post_type();?>
幸亏Wes Bos