在WordPress首页和目录页只显示摘要的方法

2009-09-13 09:55 作者: 来源: 本站 浏览: 439 次 我要评论(3条) 字号:

  在WordPress系统中,默认的首页和目录页使用的书全文输出,这对于文章内容较长的博客来说很不方面,下面我介绍一个方法,可以简单的实现在WordPress首页和目录页显示摘要而非全文。

  首先找到wp-content/themes下你使用的模板目录,查找目录中的文件,如果有home.php则修改home.php,没有的话就修改index.php,找到<?php the_content(); ?>这一行,将其修改为以下代码:

 <?php if(is_category() || is_archive() || is_home() ) {
     the_excerpt();
 } else {
     the_content(‘Read the rest of this entry &raquo;’);
 } ?>
 <div class="details"><div class="inside"><?php comments_popup_link(‘No Comments’, ’1 Comment’, ‘% Comments’); ?> so far | <a href="<?php the_permalink() ?>">Read On &raquo;</a></div></div>

  这时,你的WordPress首页和分类就显示为摘要信息而不是全文信息了。

  这段代码可以在你的首页、存档页、目录页使用摘要输出,使用摘要输出后,整个WordPress的重复内容就少多了,很利于搜索引擎优化。

无觅相关文章插件,快速提升流量

网友评论已有3条评论, 我也要评论

  1. sos000 » WordPress 插件美国 犹他州普罗沃市Bluehost公司
    2010-06-27 23:35:29 1#

    [...] Limit Posts Automatically自动截取插件wordpress显示摘要 wordpress显示摘要 http://www.miniyao.com/post/85.html http://hi.baidu.com/wordpress123/blog/item/88507417f9c9724221a4e9c4.html [...]

  2. sos963 » WordPress 插件北京市 零色沸点网络科技有限公司
    2010-05-28 02:36:36 2#

    [...] Limit Posts Automatically自动截取插件wordpress显示摘要 wordpress显示摘要 http://www.miniyao.com/post/85.html http://hi.baidu.com/wordpress123/blog/item/88507417f9c9724221a4e9c4.html [...]

  3. gray13湖北省武汉市 电信ADSL
    2009-12-13 02:58:12 3#

    敢问怎么取消邮件功能啊。。。这个问题。实在 不知道

  4. gray13湖北省武汉市 电信ADSL
    2009-12-13 02:35:14 4#

    希望可以通过啊。。。

发表评论

*

* (保密)

icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif

Ctrl+Enter 快捷回复

会员登录关闭

记住我 忘记密码

注册会员关闭

小提示: 您的密码会通过填写的"电子邮箱"发送给您.