首先后台顶部的显示选项中勾选摘要功能
然后模板中可以
<p><?php if (has_excerpt()) {
echo $description = get_the_excerpt(); //文章编辑中的摘要
}else {
echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 170,"……"); //文章编辑中若无摘要,自定截取文章内容字数做为摘要
} ?> </p>
获取可以将代码写入functions.php中来调用更加方便