wordpress有个wp_trim_words函数,该函数的功能是对给定的内容进行截取,可以指定截取多少个字,用法示例代码如下:
<?php
echo wp_trim_words( get_the_content(), 66 ); // 文章内容
echo wp_trim_words( get_the_excerpt(), 66 ); // 文章摘要
echo wp_trim_words( get_the_title(), 30 ); // 文章标题
?>
wordpress有个wp_trim_words函数,该函数的功能是对给定的内容进行截取,可以指定截取多少个字,用法示例代码如下:
<?php
echo wp_trim_words( get_the_content(), 66 ); // 文章内容
echo wp_trim_words( get_the_excerpt(), 66 ); // 文章摘要
echo wp_trim_words( get_the_title(), 30 ); // 文章标题
?>
发表回复