What are WordPress excerpts?
WordPress excerpts are a short summary of a post or page.
Excerpts are commonly shown on Blog pages.
You might also see them on search results pages or archive pages.
Often there will be a link following the excerpt to read the full post.
Here’s an example from my blog page:
There are two types of excerpt:
- Manual excerpts
- Automatic excerpts
Manual excerpts
Manual excerpts are set by the post or page author in the Excerpt box under the post editor.
New WordPress users won’t see the Excerpt box. It can be turned on by checking the relevant box in Screen Options.
More tag
Another way of controlling the summary shown is to use the More tag in WordPress.
When writing a post, use the Insert Read More Tag button in the post editor.
On the blog page it looks like this:
This method doesn’t work for pages.
Automatic excerpts
Automatic excerpts are auto-generated by WordPress.
How is this done?
The WordPress Codex entry for excerpt says:
When a post has no manual excerpt and the post template uses the the_excerpt() template tag, WordPress generates an excerpt automatically by selecting the first 55 words of the post.
When the post template uses the the_content() template tag, WordPress will look for the More tag and create a teaser from the content that precedes the More tag.
What does this mean in English?
In the first instance, WordPress will make an excerpt using the first 55 words of the post.
In the second, the text before the More tag in the post will make up a teaser.
Which method is followed depends on how your theme is coded.
How do themes handle excerpts?
Annoyingly, each theme is different – and there’s no easy way to search for how a theme handles excerpts.
Many themes will show excerpts (manual or auto-generated) on the Blog page e.g. Checathlon.
Some themes will ignore any manual excerpts and display the full post anyway on the Blog page. e.g. Twenty Sixteen.
Others will give the user a choice of what to display. This is often set in the WordPress Customizer.
My theme, Genesis, gives the option in Theme Options:
What about shortcodes?
If your post or page includes shortcodes you will likely want to set a manual excerpt.
This is so that the shortcodes don’t show up in your excerpts, like this.
This will look like gobbledegook to your readers!
Instead, write a manual excerpt that includes a few sentences from the page’s content.
Including links in WordPress excerpts
WordPress strips out all HTML from manual excerpts or text prior to the More tag. So links are not shown in excerpts.
To get around this issue you can use a plugin – Advanced Excerpt.
With the default settings of Advanced Excerpt, here’s how one of my posts looks in Checathlon theme.
Three things are there that weren’t in the auto-generated excerpt – the image, the subheading and the link.
Advanced Excerpt options
There are a few adjustments you could make to the output.
Ellipsis: Leave blank if you don’t want the excerpt to end with … Or add another HTML entity.
Excerpt length: Default is 40 but you can increase or decrease it or choose characters instead of words.
Finish: Choosing Sentence makes the excerpt end at the end of a sentence rather than cutting off in the middle.
Read more link: Adds a link at the end of the post, which is customizable. Redundant if your theme has a “Read more”, “Continue Reading” or similar link built in.
No custom excerpt: If you’ve set a manual excerpt that you want to use, check this box to retain it. Note that your manual excerpt won’t include any links or other tags.
Disable on: Disables Advanced Excerpt in certain places e.g. your home page.
Strip tags: Removes all tags except any you choose to keep. To keep links, check the box for the a
tag.
Here is another example with the following options:
- Ellipsis: »
- Finish: Sentence
- Remove all tags except the following: a
The only downside of this plugin is that the excerpts are automatic.
Here’s some code you could try if you want manual excerpts with links. It needs to be added to functions.php
.
Further reading: How To Add Functions To Your WordPress Site Safely
You’ll also need to copy and paste the text and links you want in the excerpt from the Text view of WordPress to the Excerpt box so they retain links.
Good luck!
Found this helpful? Why not share this post!
Claire-
Thanks for explaining this. Very helpful.
-Steve
Cheers Steve – thanks for reading. 🙂
It can be a pain with excerpts. I have tried plugins in the past with some success. It was not until I came across a great tutorial on StackExchange that allowed me to add to the functions.php without the need for a plugin. It allowed for HTML formatting in case people wanted links or bold face or lists.
I’m still experimenting what I really want but for now, I have limited to 24 words with the function to cut off at the end of the sentence (as opposed to mid-sentence).
If you are curious, here’s the link StackExchange Allow HTML in excerpts.
Gotta love Genesis.
Thanks Mark, that’s a useful piece of code.
I wonder if someone could turn it into a plugin?
Nice Article Claire!!
Thanks for the wonderful post. I was searching about the excerpts and you have explained it very well and clearly. I like it.
Thank you for explaining the topic and for the Advanced Excerpt plugin mention. That was very helpful! Keeps links on the home page to get maximum value, yet reduces odds of Google penalties due to thinking full blog posts on home = a poorly-constructed PBN domain.
Thanks!
Thanks Matt!
Thanks Claire, you point me up to the right way! Keep it up!
Very resourceful article. Thanks for sharing….