experience

经验

zw-1988.com

home > 经验 > wordpress 截取文章内容

2017.8.24 wordpress 截取文章内容

<?php
echo wp_trim_words( get_the_content(), 100 ); // 文章内容
echo wp_trim_words( get_the_excerpt(), 100 ); // 文章摘要
echo wp_trim_words( get_the_title(), 100 ); // 文章标题
?>
<?php
$content = get_the_content();
$trimmed_content = wp_trim_words( $content, 40, '<a href="'. get_permalink() .'"> ...阅读更多</a>' );
echo $trimmed_content;
?>

 

«
相关文章
wordpress (25)java script (9)tool (8)css (2)攻略 (1)第一次人体 (1)插件 (1)ECharts (1)food (1)雪糕 (1)动画 (1)book (1)标签云 (1)生活 (1)一言难尽的画稿 (1)
辽ICP备16002031号

Copyright © 2016 - 2020 1988-zw.com