分类
Wordpress 原创教程

WordPress文章摘要限制the_excerpt()字符数修改方法

如何修改wordpress文章摘要限制the_excerpt()字符数?

1.显示摘要的地方添加the_excerpt()。
2.将一下代码放置在主题的functions.php文件内?>前方

function custom_excerpt_length( $length ) {
return 100;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

以上办法是截取到100个字符

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注


RECOMMENDED