WordPress页面与文章有个区别,页面没有文章摘要的功能,可以通过add_post_type_support
来实现。
将以下代码添加至WordPress主题的 functions.php
add_action('init', 'page_excerpt'); function page_excerpt() { add_post_type_support('page', array('excerpt')); }
调用方法和文章摘要相同
if( has_excerpt() ){ the_excerpt(); }