Questions like “why posts don’t have read more links?” or “why only some of excerpts have […] after theme?” are one of the most common and about one of the most misunderstood (from my impressions) aspects of basic WordPress elements.
Display of posts in theme
The primary purpose of generic WordPress theme is to present posts. There is a lot of flexibility to how that can be done and so there is plenty of confusion about options.
Basically there are two main functions for that (plus their variations or direct access to text):
- the_content() – outputs full post content or teaser;
- the_excerpt() – outputs post excerpt (automatic or manual).
See? It already starts to fork.
Post content and teaser
Full post content is exactly that. All of the text in post from start to finish. In simplest case the_content() function will output all of it.
But usually that is more text than needed on pages other than post page itself. There is special text string <!–more–> which can be inserted in post content to cut post on such pages, when the_content() function is used. Effectively it creates teaser.
Teaser is part of post from start to <!–more–> tag. It gets shown by the_content() function and is automatically followed by more… link to full post.
Teasers are often confused with manual excerpts. They are completely different things.
Manual excerpt and automatic excerpt
Manual excerpt is a post summary, written in dedicated Excerpt box of post editor. It gets shown by the_excerpt() function.
If there is no manual excerpt written then WordPress tries to create automatic one for you.
Automatic excerpt is part of post from start till end or specified number of words, whichever is earlier. If word limit is reached excerpt is followed by […]
Excerpts aren’t followed by more… link.
[…] is usually considered sign of excerpt in general. That is incorrect. That is sign that post was cut to get excerpt and is not shown if there was no cutting performed.
Automatic excerpt and teaser
One of the most puzzling parts. Excerpt and teaser are related to different template functions and are not supposed to interact. But they do in obscure way and it is hard to say is this intended behavior or just ended up that way.
When post has teaser then automatic excerpt is generated from teaser (instead of full post).
This happens because post content is retrieved to cut excerpt from it. Since it happens in Loop context then if teaser present only teaser gets retrieved.
This created very common myth that teaser replaces automatic excerpt. That is incorrect. Automatic excerpt cannot be longer than teaser, but it can be shorter. And in any case they are different things.
- I want more… links – use teasers OR filter excerpt (get_the_excerpt) to append link.
- I want […] after all automatic excerpts – don’t use teasers OR filter automatic excerpt (wp_trim_excerpt) to append [...] if not present OR filter excerpt_length to shorter than your teasers.
The most confusion is when excerpt and teasers get mixed up (their weird internal synergy doesn’t help either). The best approach is evade mixing of approaches. Choose what works for you blog and stick with it.