Excerpt are the best way to automate the “read more” tag on every post of your blog. It helps in enhancing the loading time of your blog and gave space to other post on your home page. Moreover this also helps you in optimizing the wordpress blogs as can help in showing more post in less area.
How to add excerpt in the index page of the wordpress blog
Few simple steps to add excerpt in your wordpress blog
1.Open your main index.php file (located in wp-content/theme/your-theme)
2.Check for similar codes
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a>
</h2>
<small>
<?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –>
</small>
<div class="entry">
<?php the_content(‘Read the rest of this entry »’); ?>
</div>
<p class="postmetadata">Posted in <?php the_category(‘, ‘) ?> <strong>|</strong>
<?php edit_post_link(‘Edit’,”,'<strong>|</strong>’); ?>
<?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>
</p>
</div>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a>
</h2>
<small>
<?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –>
</small>
<div class="entry">
<?php the_content(‘Read the rest of this entry »’); ?>
</div>
<p class="postmetadata">Posted in <?php the_category(‘, ‘) ?> <strong>|</strong>
<?php edit_post_link(‘Edit’,”,'<strong>|</strong>’); ?>
<?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?>
</p>
</div>
3.Replace
<?php the_content(‘Read the rest of this entry »’); ?>
with
<?php the_excerpt();?>
Alternate options for non geeky friends
Use Advanced Excerpt Word plugin – This plugin will ad HTML markup in excerpt together with correcting HTML that might have been broken due to the trimming process.
Comments
9 responses to “How to auto add excerpt in the wordpress blog home page”