之前也有发过类似的代码。效果几乎都差不多
代码片段
<?php if (has_excerpt()) {
echo $description = get_the_excerpt(); //文章编辑中的摘要
}else {
echo mb_strimwidth(strip_tags(apply_filters(\'the_content\', $post->post_content)), 0, 170,\"……\"); //如果文章没有摘要,自定截取文章内容字数做为摘要
} ?>
原文链接:https://www.baijiascw.com/25644.html,转载请注明出处。
评论0