默认情况下,WordPress摘录设置为55个单词。我想获得多个摘录,每个摘录返回不同的数值,这样我就可以获得博客模板的简短摘录,其他post类型循环的自定义单词摘录。如何在wordpress中做到这一点??
发布于 2017-11-07 10:56:02
您可以使用以下函数更改内容长度
// for get_the_excerpt()
echo wp_trim_words( get_the_excerpt(), 40, '...' );
// for get_the_content()
echo wp_trim_words( get_the_content(), 40, '...' );
更多信息请点击此处https://developer.wordpress.org/reference/functions/wp_trim_words/
https://stackoverflow.com/questions/47156017
复制相似问题