WordPress有摘要显示摘要 没摘要自动截取一段正文的内容作为摘要,实现方法如下:
<?php if (has_excerpt()) {
echo $description = get_the_excerpt();
//When there is a summary, display the summary entered when entering the article
}else {
echo mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 170,"……");
//Automatically truncate a paragraph of the main text as a summary when no summary is entered
}
?>