如何让WP首页文章只显示摘要,不显示全文

方法一:手动加 more标签       <!–more–>

方法二:使用针对中文的插件      插件首页

1.后台搜索插件  wp-utf8-excerpt

2.在插件页面激活插件

3.修改主题的index.php文件,把

<?php the_content(); ?>      改成如下
—————————————–
<?php
if (is_single() or is_page()) {
the_content();
} else {
the_excerpt();
}
?>
注意:
有些主题在the_content()中还有一些字,比如the_content(’Continue Reading »’),这种要把整句话换掉。有些主题用了其他文件来控制存档页面,如category.php、archive.php等,如有必要,请对这些文件也做修改。
archive.php可以改为如下
<?php the_excerpt(__(‘Read more…’, ‘inove’)); ?>
方法三:

 

打开你的index.phparchive.php 以及category.php文件。有些人的模板并不一定都包含所有这些文件,也没有关系,只需要打开你手头上有的文件就好。

找出下面的代码:

<?php the_content(); ?>

将它替换为:

<?php the_excerpt(); ?>

这样你就可以从WordPress管理面板写自定义的摘要了。

 

 

下面是对Iblog主题的修改

/iblog/library/_posts.php

 

<?php the_content(); ?>      改成如下
—————————————–
<?php
if (is_single() or is_page()) {
the_content();
} else {
the_excerpt();
}
?>
—————————————-

未经允许不得转载:SEO_整站优化_网站优化公司 » 如何让WP首页文章只显示摘要,不显示全文

赞 (0)

评论 1

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. 1号店网上超市有没有办法把网站原有的淘宝客链接进行批量封装回复