WordPress显示摘要并修改”Read the rest of this entry”
同样不需要安装插件
使用more标签 (缺点:每次都要加一下这个东西,不灵活只能一刀切。优点:方法比较正规不需要改动模版)
在你需要截断的地方(就是你的编辑框),点“插入‘更多’标签”,或者在HTML源代码那里添加 <!–more–>
默认的显示字样一般是“Read the rest of this entry…”,这时我们可以修改这段内容,让其显示为中文,例如:”展开阅读…”。
这时你需要修改index.php,找到 <?php the_content(’ Read the rest of this entry »’); ?>, 把红色的内容替换成你想要的内容就行了~
PS:如果您使用 <!–more–> 功能,在RSS中是不会截断的,只是会在页面上显示 <!–more–>代码之前的内容 ,如果你的文章有图片或者音视频的话,这样对页面的加载速度会有帮助的。
还有种方法
使用the_excerpt标签 (缺点:需要改动模版,而且显示的是纯文本。优点:一劳永逸直接把想要的部分来做摘要)
使用方法,注意是编辑你的模版中(wp-contant/themes/你的模版/index.php) 文件)。
找到
<?php the_content(__(’(more…)’)); ?>
或
<?php the_content(); ?>
修改为:
- <?php if(!is_single()) {
- the_excerpt();
- } else {
- the_content(__(‘(more…)’));//或者<?php the_content(); ?>
- } ?>
现在你的wordpress,除非打开单个post,其他情况下都是显示摘要。
2008-08-30
标签:

















2条评论 关于 “WordPress显示摘要并修改”Read the rest of this entry””
为什么我用的the_excerpt依旧是全文啊……
Reply
Gucci
Reply