尝试使用$post->post_excerpt
而是:
// globalize $post, just in case
global $post;
// find out if the post has a defined excerpt
$data = $post->post_excerpt;
// If so, output something
if ($data) echo "<div class=\'excerpt\'>$data</div>";
此方法将绕过中固有的自动摘录生成
get_the_excerpt()
.
EDIT
根据流行的需求,相同的代码,使用
has_excerpt()
:
// find out if the post has a defined excerpt
$data = ( has_excerpt() ? get_the_excerpt() : false );
// If so, output something
if ($data) echo "<div class=\'excerpt\'>$data</div>";