WordPress is the simplest way to create a website or a blog.
I have used Squarespace, Drupal, Octopress and built from scratch. These have their pros and cons.
When you setup your WordPress site, by default the home becomes a blog feed.
Usually this feed has the full text of a blog post.
The benefits of having excerpts instead of full text are:
- It decreases page load time
- It increases page view count
These benefits are explained in more detailed in this post about how to display post excerpts in WordPress themes
Making this change is not so easy to spot. It’s not part of the Settings in WordPress and it is possible that you have excerpts not showing up.
You need to edit these 3 files:
In the Admin section of WordPress go to Appearance, then Editor:
If you are using WordPress it is important to learn some code.
You need to look for the code:
<? php the_content(); ?>
And replace it with the code:
< ? php the_excerpt(); ?>
How To show Post Excerpts
Edit Index.php To Display Post Excerpt
No matter what theme you are using, the name
index.php will appear in parenthesis:
Click on that file and use Find to search the text “the_content”
Depending on your theme you might find it or not.
In my case I am using the Theme “Sparkling” and I cannot find such line. But I found the following:
This code translate to “Get each blog post and create a list of them”.
Don’t be afraid of code.
It says: while there are posts put a post.
Then it says: Include the post format, if you want to modify it then add some file…etc.
The next line says
get_template_part( 'content', get_post_format() );
If you read it like this it makes sense: Get the template, get me the content and the post format.
We need to change a code that says
We are trying to change the format of the post content, from “showing me the whole content” to “show me only an excerpt”
The previous code gives me some clues. If I want to change the format I need to edit some other file and it starts with the word “content”.
Keep in mind that this is particular for the Sparkling WordPress theme but the same process can be applied for your theme.
Looking at my editor I found the following files:
Edit The content.php File
Find a line that says
This file has both “the_content” and “the_excerpt”:
We are lucky. The developer left some notes there so we could understand it better.
It says only to show Excerpts when using Search. Then it has an “else” as in: Only show Excerpt when using Search otherwise show the whole Content.
Let’s change “the_content” to “the_excerpt”. Then click on “Update File”.
Now go to your site and you will see that your Home page shows only Excerpts of each blog post.
Edit Archive.php To Display Post Excerpt
This file shows a similar code that the
index.php. It calls some other file to get the format of the posts. In this case it is calling the file content.php.
Manual or Automatic Excerpt
Automatic Excerpt will show the first 55 words, while manual excerpt can be added for each post. If you don’t see this field. Go to the top of the post:
Check the box “Excerpt” and you will see the following field appear towards the bottom of the post:
This is how it looks published on the home page: