How to Show Summary Instead of Full Article in WordPress

One of my friend posted a question about ‘How to show Summary/Excerpts instead of Full Articles in wordpress?’ Nowadays lots of webmasters started experimenting with wordpress templates, with a little knowledge of coding you are able to create cool custom templates. Here let us see how to work on the ‘Summary/Excerpts’ for your wordpress templates to make it more efficient and cool looks.

Why you Need to go with this?

1. The first point is the user friendliness and look for your Blog index page. If your index page shows the entire Blog posts and is having 5 blogs per page, you can imagine how lengthy the page will be. Your visitors won’t like to scroll down that much and read the entire posts. I would love to see the Summary/Excerpts in the Index page with a ‘read more’ option which leads to the individual post page. That makes the page reasonably lengthy and reader friendly.
2. If you are showing full version of posts and are also listed under same categories | archives, it may look like ‘Duplicate contents’. To avoid this, better use specific Categories and make sure they are showing only the Summary/Excerpts instead of full articles. This issue exists in rare occations, but there are chances if we use to show the Full Articles in every occurances.

How to Activate Summary/Excerpts?

  • Method 1

If you read up on The Loop in Action, you’ll find this code mentioned inside:

<div class=”entry”>
<?php the_content(‘Read the rest of this entry »’); ?>

What it means is that if you have a <!–more–> tag in your post, only the part above the more tag will show up on the first page, and clicking a link or the post title will show the Full Article on a single page.

  • Method 2

Methode 1 is sometimes won’t be the best option you needed, you may like to have an abstract | introduction to the post in the excerpt input field, instead of a part from the Article itself. This will help to give a clear idea about the full article as the Summary to the readers.

Now – How to do that…

In your index.php file, you’ll find something like

<?php the_content(‘Read the rest of this entry »’); ?>

This will be within a block like

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

You should replace the function the_content()

<?php if(is_category() || is_archive()) {
else {
} ?>

which means that on category or archive pages, you will show only the exerpts, while on single pages you’ll show the whole post.

If you want to show only exerpts on the main page you can change the condition to
if(is_category() || is_archive() || is_home()){

A Word from the Author:

Don’t forget to take the Backup while modifying the template pages, that’s always a secure way of codeing. I know these are a little bit complex steps, for the second method, but if you are comfort with a basic PHP and HTML, I think it is manageable.

One thought on “How to Show Summary Instead of Full Article in WordPress

  1. Pingback: Kavin’s Blog » Show summary/excerpt instead of full article in Wordpress

Leave a Reply