wordpress首页显示摘要及修改摘要字数的方法

阿里云代金券 腾讯云代金券 VULTR优惠码 Ucloud云主机

很多wordpress主题首页默认调用网站全文,或者首页文章摘要只显示55个字,很多朋友不知怎么修改。

今天给大家介绍一下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_content(); ?>

或者原来的摘要代码:

<?php the_excerpt("Read More..."); ?>

2、修改代码中的数字200为你想要显示摘要的字数即可。

赞(1) 领红包
转载注明:楚狂人 » wordpress首页显示摘要及修改摘要字数的方法

云计算我们是认真的

阿里云服务器腾讯云服务器

扫码领红包 或者 支付宝搜索:5981405

支付宝扫一扫打赏