<?php
global $more;
$more = 1; //1=全文 0=摘要
$my_content = strip_tags(get_the_excerpt(), $post->post_content); //获得文章
$my_content = str_replace(array("rn", "r", "n", " ", "t", "o", "x0B","""),"",$my_content); //删除空格等 如果 不想删除请直接吧这行前面 加上//
$my_content = mb_strimwidth($my_content, 0, 500,"..." ); //摘要前500字节
if (mb_strlen($my_content,'utf-8') < 10){ echo "对不起没有摘要"; } //少于10字节提示语言
else echo $my_content;
?>
首页第一篇显示全文,其他显示摘要,内容输出部分改成以下代码:
代码如下:
if(!$first){
$first = 1;
$more = 1;
the_content();
$more = 0;
}
else {
the_excerpt(); //或者使用the_content();
}
希望本文所述对大家的WordPress建站有所帮助。
本网刊登的文章均仅代表作者个人观点,并不代表本网立场。文中的论述和观点,敬请读者注意判断。
本文地址:http://www.xlkjgs.com/notes/web/3458.html
以上内容由
本站整理呈现,请务必在转载分享时注明本文地址!如对内容有疑问,请联系我们,谢谢!
给这篇文章的作者打赏

微信扫一扫打赏

支付宝扫一扫打赏
×