Some of our users wanted us to post a tutorial on how to display Post Excerpts in WordPress Themes. This is a very simple tutorial that anyone can implement and take advantage of this built-in feature. The benefit of implementing this tutorial is that it decreases page load time and it increases the pageview count.
How does it Decrease Page Load Time?
If you write long posts like best practices of contact forms or must have iphone apps for bloggers which has a lot of images, then having them load on one page can significantly impact your page load time. By adding this technique, you can simply show a mini description of the article and let user view the post on single post page.
How does it Increase Page View count?
Sometimes users just read the post on the category page if you don’t use the excerpt. By adding it this way, they will go to the original post. That is 2 page views instead of 1. It also encourages users to make a comment on the post because comment form is also on this page and they don’t need to load a separate page to make a comment.
Tutorial
Open your index.php file, archive.php file, and category.php file. Now some of you might not have all these files in your template, so just open the ones that you do have.
Find the following code:
<?php the_content(); ?>
And replace it with:
<?php the_excerpt(); ?>
Now you can write custom excerpts for your posts from your WordPress admin panel and have it displayed in your theme.

If you do not write a custom excerpt, then WordPress automatically takes the first 55 words from your post and put them in an excerpt with elipses and display it. You can change the word limit starting from WordPress 2.9. 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 '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you want to see this code working live, just click on any of our categories from the navigation menu and you will see that we do not display full posts.








This is AWESOME. Seriously thank you wpbeginner for all your articles.
Any idea of how to add pictures to the displayed excerpts?
(nevermind, I figured it out)
OMG dude, thank you so much for this! I literally spent like 45 minutes trying to figure this out with an elegant theme, only to find that your solution took about 12 seconds. Gahh! Oh well, all is well that ends well! Thanks!
The excerpt box is not appearing on my PC. Please help me.
Hi,
Im just wondering, where can I find the (Open your index.php file, archive.php file, and category.php file.)? Sorry for being a noob in HTML
Cheers,
Jay MAdisson
It would be in your /wp-content/themes/themename/ folder.
Hi, Im using Easel Theme, I opened index.php and archive.php but I could not find the code
Hello, I’m using the 2010 theme on the blog and it didn’t change to when I replaced content with the word excerpt. Is it something I’m leaving out??
Did you change the loop.php?
I am using the new twenty twelve theme to base a child theme on and cannot get excerpts to work at all. I looked in all the files you suggest above, but cannot find
in any of them. Similar to Heather I have imported my blog from blogger too…
There also doesn’t seem to be a loop.php file
Help!
The twenty twelve theme uses content.php and various variations of those.
Thanks for this – I changed entry-content in content.php to
and it has worked!
The problem I have now is how to get the excerpt text to wrap around the thumbnail, which I would like to float either right or left.
Any ideas?
Thanks
Maybe you can help me here. There is no in any of the files you listed above; index.php, archive.php, or category.php. This is the closest thing that I see (from my index.php file).
Can I change something in this code or add some new code?
If none of those files exist, that means you are using a child theme. You will have to utilize the hooks in the parent theme framework. We don’t write tutorials specific for theme frameworks.
I’m using the twentyeleven theme and “the_content” does not appear in any of the three files mentioned. I’m stumped.
Look in the loop.php file.
I am trying to get excerpt but i cant get excerpt by both of your method so tell me correctly how wll i get excerpt in traction theme.
@HemantKokcha There is only one method… changing the_content to the_excerpt… The other function is to controlling excerpt length and the excerpt read more. If its not showing in your theme, then perhaps try contacting the theme author. Because this is the only way of doing it.
@clwdk You would need to change the loop.php file for the archive.
Hi there,
I am using the newest version of the twenty ten theme and am not sure where to change the <?php the_content(); ?> to <?php the_excerpt(); ?>. There is nothing in the index.php as far as I can see. Am I overlooking something? Thanks for any help you can give me.
CARL
@Ibadullah You have to add this code in your theme’s functions.php file. It should work perfectly fine because this is the way to do it, and we are doing it on our site.
@wpbeginner@Ibadullah I am saying when I add the number in post excerpt – I just see the same number on main page. such as I type 50 in the post excerpt field it show Category name : APPLE and instead of content it show number 50
@Ibadullah That is the whole point of this article.
It keep showing me the number I add in post excerpt instead of post content!
http://games-masti.com/
This is very nice trick and thanks for help us and thanks for the whole team of the word press team
<a href=”http://www.games-masti.com” title=”Play Online Games”>Play Online Games</a>
This is very nice trick and thanks for help us and thanks for the whole team of the word press team
Great – thanks. Was looking for a simple solution. How do you include a Read more… link after the excerpt also though?
http://www.wpbeginner.com/wp-tutorials/how-to-display-a-read-more-link-in-wordpress-excerpts/ << Try this article.
Thank you for the article. I made the changes in all 3 documents and nothing changed. All of the posts on the blog I am working on were imported from Blogger, could that be an issue or perhaps the theme itself? I am stumped!
Nope that can’t be the issue. By changing to the_excerpt it would automatically generate the excerpt.
I can’t seem to find any files containing “php” anywhere on my wp dashboard.
I’m using dreamhost and the wp 2010 theme. The only files I can find that allow me to edit code are .css files.
I’m going crazy trying to find a way to create excerpts!
Look under Appearence > Editor (There you will find the file)
thanks! just changing the index.php ‘content’ to ‘excerpt’ did the trick…
My acquaintance is asking for this and I remember to ever saw it here. Thanks, I will forward this to him.
I understand the excerpt thing but how do I then get it to show the image thumbnail along with the excerpt?
By adding the WordPress Thumbnail there: http://www.wpbeginner.com/wp-themes/how-to-add-post-thumbnails-in-wordpress/
You would have to add styling to match your theme.
Great, I was just looking for an easy way to make use of the excerpts field and be able to define a small intro for each post to be displayed. Thanks a lot.