本文最后更新于 1211 天前,文中的信息可能已经有所变化。如有误,请留言反馈。
某些页面可能没有内容摘要功能,可以自行添加,只需两步即可拥有摘要功能:
- 将以下代码添加到正在使用主题的 functions.php 文件内:
add_action('init', 'page_excerpt');
function page_excerpt() {
add_post_type_support('page', array('excerpt'));
}
- 在需要调用的地方放入以下代码:
if( has_excerpt() ){
the_excerpt();
}