wordpress文章摘要限制the_excerpt()字符数(文字数量)
时间:4年前 阅读:1634
其实限制摘要有很多办法,下面先给出一个全局的办法,设置后只要在希望显示摘要的地方添加the_excerpt()即可。
将一下代码放置在主题的functions.php文件内?>前方
function custom_excerpt_length( $length ) {
return 200;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
以上办法是截取到200个字符
网友评论