Like Quertime on Facebook!

How to Display Post Excerpt and Post Summary on Your WordPress Blog

Filed under WordPress

By default, WordPress displays full post on the homepage and category pages. However, some users prefer their posts to be published in the form of excerpt (partial post), making their blogs look more decent. In fact, there are some benefits of publishing posts in excerpt form. Imaging if your visitors load a page which has lots of images, it can significantly impact your page load time. By using excerpt, you can simply show a short description of the article and let visitors view the post on single post page.

how_to_display_post_excerpt_and_post_summary_in_wordpress_themes

Other than that, excerpt also helps to increase page view count. Imaging if you don’t use the excerpt, your visitors will just read the post on the homepage or category pages. By adding it this way, they will go to the original post. That is 2 page views instead of 1. Without further ado, let us show you 2 simple tutorials on how to display post excerpts in your WordPress blog.
(Image Source: Dailyblogging.org)

Method 1: Using More Tag
wordpress_more_tag

When you have written your post, select where you would like to make the cut-off between the partial post and the rest of the page, then click the “More” button. Your homepage, and category pages, will now display only the first section of the post, and a line of text linking to the full article. This line defaults to, “Read the rest of this entry »”.

Tip: To change this line of text, open your index.php and archive.php template file, and change the following line: (Make sure you retain the quotation marks!)

Example:
<?php the_content('Read the rest of this entry »'); ?>

changed to

<?php the_content('Read more…'); ?>

Method 2: Using Post Excerpts Function
To use the post excerpts function, you will need to edit your template’s files, namely those controlling your home and category pages (These will be index.php and archive.php). Some of you might not have these files in your template, so just open the ones that you do have.

Replace the following code:
<?php the_content('Read the rest of this entry »'); ?>

with

<?php the_excerpt(); ?>

Your pages will now show the excerpt. However, to load the post, your readers will have to click the post title. To solve this, you can add a link below the content, which can be used to load the rest of the article, similar to the one generated by the <!–more–> tag. Beneath the line you just edited, add the following:

<a href="<?php the_permalink(); ?>" title="Read the rest of <?php the_title(); ?>" class="more-link">Read the rest of this entry »</a>

By default, WordPress will now show the first 55 words of your post. You can change this however, by pasting what you want to be shown into the “Excerpt” box in the Write Post screen. This box understands code, so if you intend upon including images in the excerpt, then you can copy and paste directly from the Code View on the Write Post page. Through using this method, you can choose to display different text on the homepage than what is in the article. For instance, you may want to write a summary of the article to come, not merely quote the introduction.

wordpress_excerpt_box

Tip: If you want to change the word limit, open your functions.php file and add the following function:

// Changing excerpt length
function new_excerpt_length($length) {
return 100;
}
add_filter('excerpt_length', 'new_excerpt_length');
// Changing excerpt more
function new_excerpt_more($more) {
return '%u2026';
}
add_filter('excerpt_more', 'new_excerpt_more');

Author: Jules, Quertime Editorial

Founder of Quertime.com. Connect with him on Facebook, follow him on Twitter or circle him on Google+.

Tags: , , ,

Comments are closed.