网页设计欣赏/JS/CSS/Flash/Discuz/Wordpress/5UCMS/程序模板设计

实现在WordPress首页和目录页显示摘要方法

星期六 Oct 24, 2009

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>

相关文章:

1 个人感兴趣!

shikake 对《实现在WordPress首页和目录页显示摘要方法》的评论

你好! 我想问下我用的是2.86版,在\wp-content\themes\default的默认模板里我在index.php找不到,要怎么设置才能实现在WordPress首页和目录页显示摘要方法..希望能帮我解决

12月 7th, 2009 | 4:28 pm
我来说两句!哈!