wordpress 自带的摘要显示函数代码虽然简单,但要想实现摘要字数的控制,需要借助一些插件才能实现。今天为大家介绍一段可以简单调整摘要字数的代码,代码如下:
<?php echo mb_strimwidth(strip_tags(get_the_content()),0,200,” “);/*the_excerpt();the_content(__(‘Read more…’, ‘inove’));*/ ?><a rel=”more-link” href=”<?php the_permalink()?>” title=”<?php the_title(); ?>”>阅读详情…</a>
使用方法如下:
1、将该代码替换原摘要代码:
<?php the_excerpt(“Read More…”); ?>
2、修改代码中的数字200为你想要显示摘要的字数即可。
相关阅读: