WordPress默认显示文章摘要的代码

首先找到wp-content/themes下你使用的模板目录,然后修改index.php,找到
<?php the_content(); ?>

这一行,将其修改为以下代码:

<?php if(is_category() || is_archive() || is_home() ) {the_excerpt();} else {the_conten ('Read the rest of this entry »'); } ?>
<div><div><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> so far | <a href="<?php the_permalink() ?>">Read On »</a></div></div>

这样便可以显示文章的摘要了。不过摘要不显示图片。

Related Posts