wordpress首页显示摘要

Posted in: Wordpress, 杂七杂八

WordPress默认没有摘要功能,这就导致首页和目录页面全文输出.这对于大多数国人来说,浏览十分不便.

因为全文输出会拉长WordPress首页和目录页,不但影响浏览,而且会减慢浏览速度.

以下yesure给大家介绍一下WordPress首页和目录页摘要的解决方案.

修改当前主题下的index.php文件,找到<?php the_content(); ?>这一行,当然有的WordPress博客的主题中可能含有其他的字符,比如blinux有一个WordPress博客的是

1
<?php the_content(__('Continue Reading &raquo;','ml')); ?>

直接将这一行替换为下面的代码:

1
2
3
4
5
<?php if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content('Read the rest of this entry &raquo;');
} ?>

或者改成这样也可以

<?php if(is_category() || is_archive() || is_home() ) {
the_excerpt();
} else {
the_content(‘Read the rest of this entry &raquo;’);
} ?>
<div><div><?php comments_popup_link(‘No Comments’, ’1 Comment’, ‘% Comments’); ?>  | <a href=”<?php the_permalink() ?>”>阅读全文&raquo;</a></div></div>

这样wordpress首页摘要就搞定了,实现了WordPress 本土化.

分享到:

热门文章-HOT

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

.