• Skip to content
  • Skip to footer
A Bright Clear Web

A Bright Clear Web

A Bright Clear Web - Simple, effective, accessible websites

  • Home
  • About
  • Websites
  • Writing
  • Learn
  • Blog
  • Contact
You are here: Home / WordPress / How To Create WordPress Excerpts And Include Links In Them

How To Create WordPress Excerpts And Include Links In Them

Posted: May 28, 2017 Updated: July 19, 2024 by Claire Brotherton
9 Comments

Advanced Excerpt with custom options selected

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.

There may be a link following the excerpt to read the full post.

Here’s an example from the previous theme of my blog page:

A blog post excerpt. An ellipsis follows at the end of the text, followed by a Continue Reading link.
A blog post excerpt. An ellipsis follows at the end of the text, followed by a Continue Reading link.

And here’s an example from the blog theme now:

A blog post excerpt without a Continue Reading link

There are two types of excerpt:

  1.  Manual excerpts
  2. Automatic excerpts

Manual excerpts

Manual excerpts are set by the post or page author in the Excerpt box.

If you’re a Block Editor user, a link to add an Excerpt box is in the right sidebar under the Post tab.

Showing the Excerpt box in the block editor
Showing the Excerpt box in the block editor

If you are using the Classic Editor, the Excerpt box is under the post editor.

WordPress excerpt box with a manual excerpt added
WordPress excerpt box with a manual excerpt added

If you don’t see the Excerpt box, it can be turned on by checking the relevant box in Screen Options.

Screen Options with Excerpt box checked

More tag

Another way of controlling the summary shown is to use the More block or tag in WordPress.

Block editor users can find the More block in the Design section, or by searching for More.

More block

This is what a post looks like using the More block in the editor:

Post with More block

For a Classic Editor user, when writing a post, use the Insert Read More Tag button in the post editor.

The Read More button and generated tag, shown by arrows
The Read More button and generated tag, shown by arrows

On the blog page it looks like this:

The excerpt ends with the More tag
The excerpt ends with the More tag

This method doesn’t work for pages.

Automatic excerpts

Automatic excerpts are auto-generated by WordPress using the_excerpt() function if no manual excerpt is set. The default length of an automatic excerpt is 55 words.

All shortcodes and HTML tags are removed from automatic excerpts.

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.

Excerpts as shown in Checathlon themes
Excerpts as shown in Checathlon theme

The GeneratePress theme will show both automatic and manual excerpts on its Blog page, as shown below.

GeneratePress automatic and manual excerpts

Some themes will ignore any manual excerpts and display the full post anyway on the Blog page. e.g. Twenty Seventeen.

Twenty Seventeen theme shows the full post, not the excerpt
Twenty Seventeen theme shows the full post, not the excerpt

Twenty Sixteen displays excerpts in an unexpected way. It shows the excerpt first in a larger typeface, followed by the full post.

Twenty Sixteen excerpt handling
Twenty Sixteen excerpt handling

Other themes will give the user a choice of what to display. This is often set in the WordPress Customizer in classic themes.

My theme, Genesis, does this:

Genesis Content Archives settings showing Entry excerpts setting
Genesis Content Archives settings – Display Entry excerpts

Customizing excerpt length

In block themes

If you’re using a newer block theme, you can change the excerpt length by editing the blog page template. Here’s an example using the Twenty Twenty-Three theme.

Go to Appearance > Editor > Templates and select the Blog Home template from the list.

Selecting the Blog Home template in Twenty Twenty-Three theme

You’ll be taken to the template editor. You’ll notice that this theme ignores manual excerpts. Instead all excerpts are a maximum length of 55 words.

Editing the Twenty Twenty Three Blog Home template

You can change the number of words in the excerpt by clicking on the Excerpt block and dragging the Max Number of Words slider in the Block Settings to a different value, from 10 to 100. Changing the value here applies to all excerpts.

Changing the excerpt length in Twenty Twenty Three

This is what two posts look like in the editor with 70 word excerpts:

Twenty Twenty Three 70 word excerpts

In classic themes

If you’re using a classic WordPress theme, your theme may have a settings page or WordPress Customizer setting that lets you change the excerpt length. Check your theme documentation.

If not, you can use a plugin – Advanced Excerpt.

Advanced Excerpt

Advanced Excerpt lets you set the excerpt length and customize the Read more link. Here is what an excerpt looks like in GeneratePress with the following options set:

Excerpt length: 30 words.

Ellipsis: … This generates three dots after the excerpt.

Read more link: Add read more link to excerpt with text “Read the rest”.

GeneratePress 30 word excerpt with Advanced Excerpt
GeneratePress 30 word excerpt with Advanced Excerpt

Including links and other HTML elements in WordPress excerpts

Automatic excerpts in classic themes

WordPress strips out all HTML from automatic excerpts or text prior to the More tag. So links are not shown in excerpts.

To get around this issue you can again use the Advanced Excerpt plugin.

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 usage showing a subheading, link and image in the excerpt
Advanced Excerpt usage showing a subheading, link and image in the excerpt

Advanced Excerpt options

There are a few adjustments you can make to the output.

Excerpt length: Default is 40 but you can increase or decrease it or choose characters instead of words.

Ellipsis: Leave blank if you don’t want the excerpt to end with … Or add another HTML entity.

Finish: Choosing Sentence makes the excerpt end at the end of a sentence rather than cutting off in the middle.

Read More Link: Checking the Add read more link to excerpt adds a link at the end of the post, which is customizable. You can:

  • change the text – the default is “Read the rest”
  • have the link open in a new tab (not recommended for accessibility)
  • append the post title to the link for screen reader users
  • have the link shown for custom excerpts too

No Custom Excerpts: If you have the Generate excerpts even if a post has a custom excerpt attached option checked, the plugin will ignore manual excerpts and create its own based on your settings. If only the option below is checked, Use the custom excerpt (if disabled the excerpt is generated from the content) you should see manual excerpts where they have been defined. The Read more link will not show unless you have the Add the link even if a custom excerpt is shown from the Read More Link options checked.

Link Whole Excerpt: Turns the entire excerpt into a link to the post.

Link whole excerpt enabled in Advanced Excerpt
Link whole excerpt enabled in Advanced Excerpt

Strip Shortcodes: removes shortcodes from the excerpt.

Filter: filters the_excerpt() and the_content() functions in your site.

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
  • Strip Tags: Remove all tags except the following: a
Advanced Excerpt with custom options selected
Advanced Excerpt with custom options selected

Manual excerpts with links in classic themes

You can set manual excerpts with links or other HTML tags by adding the tags to your excerpt. The easiest way to do this if your excerpt is based on the post content is to copy the relevant content from the editor and paste it into the excerpt box.

If you’re a classic editor user, you can switch to the code view and copy and paste the relevant text, and then paste it into the Excerpt metabox.

Copy text from the Text view to include HTML

Block editor users need to switch to the code editor:

Selecting the code editor in the block editor
Selecting the code editor in the block editor

And then copy the relevant code:

Copying HTML code in the block editor
Copying HTML code in the block editor

Then add the code to the Excerpt box and save it.

Block editor Excerpt with link
Block editor Excerpt with link

Here’s how the excerpt looks in GeneratePress, without the Advanced Excerpt plugin active:

Manual excerpt with link in GeneratePress

If you have a lot of manual excerpts, here’s some code you could try if you want manual excerpts with links. It needs to be added to your theme functions.

Further reading: How To Add Functions To Your WordPress Site Safely

Excerpts with links or HTML tags in block themes

Unfortunately, at the time of writing, block themes use the Excerpt block for displaying excerpts, and this block strips HTML tags from the excerpt so you can’t have links or other HTML e.g. bold text in a block theme excerpt – even if you have set an excerpt manually with tags.

This is a known issue and is documented here: [Block] Post Excerpt – Allow inline HTML tags. There are a couple of code solutions suggested, but I tried them and couldn’t get them to work. For the time being it looks as if we’ll have to wait for an answer.

What about using the Advanced Excerpt plugin?

Here, in this example from Twenty Twenty-Three theme; you can see that the plugin is setting the excerpt length to 40 words, but the links in the excerpts aren’t there and neither is the Read more link.

Twenty Twenty Three excerpts without links or HTML tags

Plugin user arnkoe wrote a post on the plugin’s support forum about the excerpt Read more links not working in Twenty Twenty-Three, and fellow user butesa has created a patch. I hope that this will be incorporated into a future release of the plugin soon.

Found this post helpful? Why not share it!

Related

Category: WordPress Tags: excerpt

About Claire Brotherton

Freelance web designer and front end developer based in Edinburgh, Scotland. I love WordPress, code, learning and blogging.

Reader Interactions

Comments

  1. Steve Teare says

    May 28, 2017 at 11:24 pm

    Claire-

    Thanks for explaining this. Very helpful.

    -Steve

    Reply
    • Claire Brotherton says

      May 29, 2017 at 10:40 pm

      Cheers Steve – thanks for reading. 🙂

      Reply
  2. Mark McGuire says

    May 30, 2017 at 7:57 pm

    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.

    Reply
    • Claire Brotherton says

      June 1, 2017 at 11:10 pm

      Thanks Mark, that’s a useful piece of code.

      I wonder if someone could turn it into a plugin?

      Reply
  3. Emily Brown says

    September 22, 2017 at 6:26 am

    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.

    Reply
  4. Matt says

    June 15, 2018 at 6:32 pm

    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!

    Reply
    • Claire Brotherton says

      June 18, 2018 at 11:06 am

      Thanks Matt!

      Reply
  5. Sensmedia says

    May 28, 2019 at 5:33 am

    Thanks Claire, you point me up to the right way! Keep it up!

    Reply
  6. John Lawson says

    February 22, 2021 at 6:26 pm

    Very resourceful article. Thanks for sharing….

    Reply

Leave a Reply Cancel reply

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

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email. Read my privacy policy.

potted cactus and laptop with code

Footer

Categories

  • Accessibility
  • Blogging & Content Marketing
  • Business
  • Personal
  • Software & Tech
  • Websites
  • WordPress

Top Posts

  • How To Create WordPress Excerpts And Include Links In Them
  • How To Solve WordPress Image Alignment And Text-Wrap Problems
  • Improve Your Divi Website's Reach With Divi Accessibility
  • How To Set Up And Customize Twenty Nineteen Theme
  • Registering a Domain Name with GoDaddy - Step by Step

Let’s Be Social

  • E-mail
  • Facebook
  • LinkedIn
  • Twitter
Copyright © 2014 -2025 A Bright Clear Web
  • Privacy and cookies policy
  • Site map