Sarathlal N

Show post excerpts in archives and index pages in WordPress

In default, Home and Archive pages in WordPress themes shows a recent list of posts with complete content. But almost people like to display only a list of post excerpt in Home and Archive pages.

Post excerpts are short notes about our posts for visitors. We can handcraft each post excerpt or can use beginning of post as excerpt in WordPress theme. The post excerpts reduces web page loading time and it help visitors to evaluate the full content and the subjects covered in that post.

Almost WordPress themes are capable to display automatically fetched post excerpt in certain conditions. In WordPress twenty twelve and twenty thirteen themes, it show automatically fetched post excerpt in search result using the content template.

If you are using Twenty Twelve or Twenty Thirteen themes, in line 33 of content.php, you can find a if statement.

<?php if ( is_search() ) : // Only display Excerpts for Search ?>

Now we want to modify this if statement which shows post excerpt for search result.

Now your home page shows automatically fetched post excerpt from our post with […] at the end. We can easily remove this Excerpt more symbol […] with a Continue Reading text link.


*If there is no `content.php` file in your child theme folder, just copy `content.php` file from parent theme and paste it in to child theme folder. Then edit this `content.php` file in child theme folder. Please read this post about WordPress child theme before. **Same like `content.php` file, a `functions.php` file is required in our child theme folder. It is not a copy of parent theme's `function.php` file.

Need Help?

Do you need any help on WordPress? I'm happy to help you.

Contact Me

Recent Posts

  1. Get variation product data on selecting variation options - WooCommerce
  2. Add TinyMCE WYSIWYG (Rich text area) meta box - WordPress
  3. Reorder product tabs in single product page - WooCommerce
  4. Download webpage for offline reading - wget
  5. Remove product tabs in single product page - WooCommerce

Your Questions / Comments

If you found this article interesting, found errors, or just want to discuss about them, please get in touch.