Hey, this is Ben from WPAnswered.com. In this video,
you'll learn how to create custom post excerpts.
When you publish posts in WordPress, you might see something like this:
a featured image, a title, a byline,
and an excerpt that automatically uses a certain number of words from the
beginning of your post.
Now the number of words that appear here will depend on the theme that you're
using. In this case,
I'm using the minimalist Apex theme by Compete Themes and I also have the option
to control the number of words that show up in this excerpt.
But regardless of what theme you're using,
there are three different ways you can define your post excerpts.
First of all, you can do nothing at all and you'll have the first,
um, usually 25 to 50 words used here,
followed by an ellipses,
or you can use a "read more" tag.
And that is the second way to define your excerpt.
So I'm going to click on the title to take me to this post. As you can see,
I've got some filler text, just some nonsense language here,
followed by an image and some more text.
And if I click Edit Post in the admin toolbar,
this will take me to the Gutenberg post editor. Inside here. Um,
let's say I want to use this entire paragraph as my excerpt.
I can press the Enter key,
click on the Add block button and you can see the more tag included in my Most
Used section. But if you've never used it,
you can find it in the Layout Elements section,
or you can always search in the search bar for more.
Once I press it, it will be included in my post.
And after I update and visit my homepage,
you'll see the excerpt now includes this entire section that I defined with the
read more tag.
Everything above it is used as the excerpt.
The one other benefit,
which actually could be a con depending on what you want in your excerpt, um,
of using the read more button, is that if you do add a read more block,
I should say, it will include everything above it,
including images, links, bullet points.
All the HTML that shows up that would normally be stripped from an excerpt will
show up when using the read more block.
So I'll place in another more block just to show you how this works and when I
update my posts,
you'll see that it now displays the image and the text following it.
Just to further illustrate this, if I was to add a link,
and right now I'm highlighting some text,
and now pressing Command+k to open up the link input,
and I'm just going to include a link to google.com, update,
and refresh. You'll now see this text is linked here.
If I remove the more block and switch back to the automatic excerpt,
you'll see that it removes the link.
So whenever you're relying on an automatic excerpt,
it will automatically remove all HTML.
So if there was an image between these two words here,
it would be removed as well. Links get removed.
If you want to maintain the HTML that you have, images, links, lists,
anything like that, you'll want to use a read more tag instead.
Now there's a third method which is what I recommend using and this is what I
use on all of my sites.
It's to use the custom excerpt option instead.
And in here you can type whatever you want
and then this text will show up in the excerpt section.
Now what's so nice about using a custom excerpt is that you don't need to worry
about what you've written as the main introduction to your post.
Instead you can concentrate on writing a teaser,
a short amount of text that's designed - when people are browsing through your
posts - this text is designed to get them really excited to read your post.
So they show up, the image gets their attention, the headline sounds good,
and then when they read the excerpt they just have to read it.
And so taking the time to write, um,
to write excerpts that really make your posts sound exciting and interesting,
it's definitely worth your time.
One other tip I'm going to recommend is that if you use the popular Yoast SEO
plugin and you're writing your meta descriptions,
you may as well copy and paste those meta descriptions into the Excerpt box so
that they show up on your main blog page as well.
I hope you learned a lot from this video. If you liked it,
please remember to click the Like button below.
If you want more WordPress tutorials, click Subscribe,
and if you have any questions,
go ahead and post them in the comments section below. Thanks for watching.
