WordPress Manual Excerpts, Automatic Excerpts, and Teasers (More Tag)

This article is all about clearing up confusion. The strange mix of names that all seem to have the same meaning but do totally different things and require different approaches has a lot of WordPress users struggling to make sense of it all. I’ll fix that.

I’ll try to keep the important information short and to the point so you can get back to managing your site. That might be difficult to do, though. Oh well… let’s get started.

The Important Information

There are three different ways to show just an “introduction” to your post content.

  • Manual Excerpts
  • Automatic Excerpts
  • Teasers (more tag)

All three of these methods depend on how your theme is built as well as what actions you take. So that’s what we’re going to clear up.

We’ll talk about each of these methods in a logical manner.

Manual and Automatic Excerpts

Manual excerpts are so undervalued in the WordPress community. It seems like almost no one uses them when really, they’re probably the most useful.

A manual excerpt is true introduction text for an article. I say that because it does not automatically pull content from anywhere. You must write out a manual excerpt yourself.

When creating a new post, there’s an “Excerpt” box available for doing just that… and here it is.

manual-excerpt

This textarea appears somewhere below the post edit box and is just waiting to be used.

If you do not see it, it is most likely hidden by default. Scroll up to the top of the post edit screen and click the “Screen Options” drop down. In there, make sure the “Excerpt” box is checked.

This is where the confusion starts. Though the manual excerpt is an excerpt, most WordPress users are used to the automatic excerpt which strips all HTML tags from the content, displays a number of words by default, and slaps an ellipses […] at the end.

Nope. The manual excerpt is different in that you can use some HTML in it. Double line breaks create paragraphs. You can insert HTML for links. It’s basically a dumbed down HTML editor.

So, is the manual excerpt really an excerpt? Did it actually take text from somewhere else? No it did not. So it’s really not an excerpt. Just accept its name and life will be a lot easier for us all.

Implementing Excerpts

As stated above, all three methods depend on actions you’ve taken and how your theme is built. For manual excerpts, you’ve already taken action by putting content in the Excerpt box. Now we have to see if the theme is ready to handle it.

There’s a function used for displaying excerpts in WordPress template files called the_excerpt().

When used in the correct spot, this function will display an excerpt for the post it’s representing. However, it has a firing order, and that’s what most users don’t know.

The first thing this function will look for is a manual excerpt, the one we’re discussing now. If it exists, it will be display on the front-end with all of its allowed HTML intact. No ellipses will be placed at the end. No allowed HTML will be stripped. It’s just the text you typed… period.

The second thing this function will look for, only if the manual excerpt does not exist, is the content of your post. Why? Because it will now take a specific number of words (55 by default) from your post content and use it as a true excerpt. This is the automatic excerpt.

The automatic excerpt is the one that most users are familiar with. If you’ve ever pasted code into your functions file for things like changing the excerpt length, removing the ellipses, or adding a link to the full article, you were using automatic excerpts and you’ve probably seen this codex page.

That means instead of creating a manual excerpt exactly the way you wanted it, you were allowing WordPress to automatically create the excerpt for you and then you jumped in and customized that excerpt. There’s nothing wrong with that at all! Just understand what’s happening.

Again, like the manual excerpt, the automatic excerpt only displays if your theme uses the_excerpt() in its template files. With that established, it only displays if the manual excerpt doesn’t already exist.

Does all of that make sense? I hope so… because we’re not done.

With this basic but thorough understanding of when excerpts are used, it’s important to know when and how to use what. This is where building WordPress websites with intent comes into play.

Let’s look at a real world example and determine the best way to use excerpts.

Goal: Display post excerpts with a link to the full article.

Cool. We’ve all seen it before. Did you realize there were two ways to do it, though?

As a theme developer, I find it easier to use manual excerpts on my own websites because I know for a fact that I will create a manual excerpt every time I write a new post.

So, in my template files responsible for displaying excerpts, I’ll use the_excerpt() as expected. However, I won’t stop there. I’ll add an HTML/PHP snippet below it to make sure each of my excerpts links to the full post it represents.

<p><a href="<?php echo get_permalink(); ?>"> continue reading...</a></p>

That’s nothing more than a link to the full article. We’re able to use get_permalink() because we’re working inside of the WordPress loop… so that function will automatically grab the URL of the post being displayed.

Also notice that I wrapped the link in paragraph <p> tags. Remember, our code is preparing to deal with manual excerpts. That means the excerpt content will automatically come in the form of one or more paragraphs. Now our link to the full post keeps the paragraph flow going. Boom.

What I just described is the exact method used here on BWPY.

manual-excerpt-example

I am not using a more tag there. That’s a manual excerpt. The content in my manual excerpt does not appear anywhere else on the site. It is 100% intentional and is a true introduction to the article.

This is a much cleaner solution than using more tags, which I’ll discuss here shortly. I say it’s cleaner because my excerpt was built with intent. I never have to worry about whether or not I have a video too high in my content and whether I should put my more tag above or below it. Do you know what I mean? Silly problems.

Getting back to the link at the end of an excerpt scenario, the alternative to using manual excerpts and editing the template file to automatically output a link to the full article, you could leave the manual excerpt textarea empty, let WordPress create the excerpt for you, and then add a link to the full article by filtering the excerpt in your functions file like so.

function new_excerpt_more( $more ) {
	return ' <a class="read-more" href="'. get_permalink( get_the_ID() ) . '">Read More</a>';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );

Using that method, you’re pretty much stuck with an inline link unless you know CSS. In my opinion, it’s a slippery slope to that leads to too many components coming together to do one simple job. So I use manual excerpts intentionally every time I write a post.

Just to recap before moving on to the More Tag, when the_excerpt() is used in a theme, it will display one of two things in the following order:

  1. a slightly formatted excerpt created by using the “Excerpt” textarea beneath the edit post box
  2. a true excerpt pulled directly from the post content and stripped of all HTML

Plain and simple. Understand your needs and choose with intent.

The More Tag

I hope you didn’t think I forgot about the more tag. Fortunately, it requires much less of an explanation.

Keeping in mind that excerpts will only display if the_excerpt() is used in your theme, when it is not used, you’re most likely dealing with the_content().

This function is simple. It displays all of the post (or page) content. That’s it. Whatever is in your content – videos, links, iframes, high resolution images – everything will be displayed wherever the_content() is used webpage.

That said, the common way to stop this function from displaying all of your content and allowing it to link to the full article is by inserting the more tag.

If you’re using the visual post editor, you can insert a more tag by clicking the following button with your cursor where you want the content to end and display a link…

more-tag-visual

Too easy, right? On the single post page, the full content will display with no interruptions. On the blog home, or wherever your blog posts are listed, the content will display up to that more tag, and then a link will be inserted. When that link is clicked, the visitor will be taken into the full post and automatically placed at the point where that more tag was placed (they will not be able to see it). It’s a true “read more” tag.

If you’re using the text editor for writing posts (as opposed to the visual editor), you can insert the more tag by clicking the more button or typing it manually – <!--more-->.

So again, just like the excerpts, the more tag depends on what you have done as well as what your theme has done.

The biggest difference here is that without using a plugin, using more tags is not an automatic job. You must place a more tag in every single article to make sure that all of your articles are properly truncated.

It’s also important to note that any content that appears before the more tag will display as-is wherever the post content is displayed. Unlike automatic excerpts, no HTML is stripped. So keep that in mind.

One final note about the more tag, it can be customized as well. The the_content() function used to display full content accepts parameters, one of which is called “more link text.”

It allows you to select the text that will display as the link to continue reading the article. So instead of your theme template files simply displaying the_content(), you could implement it like so…

<?php the_content('Read more...'); ?>

Now every time the more link is displayed, it will show “Read more…” and link it to the full article. For more information on customizing the more tag, check out the codex pages on customizing the read more and the the_content() function itself.

Any questions?

Additional Tips for Theme Developers

You probably noticed that I talked a lot about theme files in this article. Average users probably had no idea what I was talking about, though. That’s fine. You do.

That said, I think it’s a good idea that you do a little bit of the work for them since it’s a theme’s responsibility to display user content.

In my article on Customizing Client Options Using the Theme Customizer, I give all the code you need for creating a theme customizer option for toggling between excerpts and full posts.

For novice users, actually being able to see the difference between excerpts and full posts is a big deal. With that in place, articles like this one are a lot easier for them to understand.

14 Comments:
  1. This is cool. Brilliantly explained.

    Quick Question: Can one get auto-excerpts display when no custom excerpt is inputted. So something like // if custom excerpt, then display. else auto-excerpt display…

    • Good question!

      The quick and simple answer is that you don’t have to worry about that at all. When the_excerpt() is being used, it’s ready to run itself through that conditional for you by default. So if there’s no manual excerpt, it will go ahead and create an automatic excerpt instead. Remember this happens post by post. So it doesn’t matter if you use manual excerpts for every other post. Each individual one still runs through that conditional.

      A little more complicated answer has to do with the tip I gave in the article on placing a link to the full article to display after the manual excerpts. If you have that link in place but do not fill out the manual excerpt field, that link will still show. That’s perfectly fine if your theme or functions file hasn’t used a filter to add a link to the end of auto excerpts. If it has, though, you’ll end up with double read more links if you don’t use a manual excerpt.

      To prevent that, you’d want to wrap the extra read more link created for your manual excerpts in a conditional itself. WordPress already has you covered… has_excerpt().

      <?php if ( has_excerpt() ) { ?>
      <p><a href="<?php echo get_permalink(); ?>"> continue reading...</a></p>
      <?php } ?>

      With that setup underneath the_excerpt(), using a manual excerpt will display the formatted excerpt with its custom read more link. Not using a manual excerpt will display an auto excerpt with no custom read more link. However, if you’ve filtered the_excerpt() using auto excerpt methods, your link can be created that way (or don’t filter it and just use the custom link). So many options… being aware of them all helps you understand what’s right for your theme.

  2. hey bro!
    i’m so excited to return for further reading and learning.
    can’t thank you enough for putting out all your skillz and knowledge on WP.
    you are making the world a better place!
    thanks so much!

  3. Thanls a lot. I wast looking for manual excerpts and I could not find this option in WordPress. I was even thinking about looking for some plugins because excerpt option was nowhere in options menu – they hid it well. Now I can continue building my website.

  4. Hi! Thanks – this is really useful!

    Is it possible to have the “continue reading” link only show if the manual excerpt is filled out? I’ve upped the automatic excerpt to 500 words so that the full post will show if there’s no manual excerpt, but I don’t want a “continue reading” link after the full content. I’ve read a lot of how-to articles and I can’t figure out if this is possible with WP.

Leave a Reply

Your email address will not be published. Required fields are marked *

*