How to Show a WordPress Excerpt in Your Theme

wordpress excerpt

An excerpt is a small snippet of an article in WordPress that is displayed to the visitor rather than the whole post. You see these often when you visit a blog or webpage that shows several posts in one small area. This gives the visitor a chance to see what the article is about before clicking on it to read the whole thing.

It’s a great method to give the visitor a sense of control over what he or she is choosing to read.

In this tutorial, we’re going to show you how to use a WordPress excerpt and how to control what gets viewed by your guests. You may find that the perfect snippet of information may entice people to read otherwise unpopular posts.

Keep in mind that the content excerpt is not the same as a meta description.

Why a WordPress Excerpt is Important

Let’s say that you have visitors coming to your homepage. When they look at the list of content you’ve created, do they get the sense of what each piece covers? A title and a thumbnail image can only go so far.

An excerpt clarifies what a post is about and may lead to more interaction. This is one of the reasons why it’s important to engage an audience within the first few sentences.

Some online tools will pull content directly from the excerpt. Having this set up logically may contribute to generating greater functionality and productivity from those specific tools.

How to Add An Excerpt to WordPress

Method 1: Using a Theme

Some themes are well equipped to handle using excerpts on the front page. For example, the ColorMag theme offers widgets to use on the homepage which includes the excerpt. However, some themes do not have this functionality, thus there are other methods.

If you want to check to see if your theme has something similar to ColorMag:

Step 1: Check Your Theme

Click on Appearance and select the Widgets option.

Widgets

Scroll down until you locate the Featured Posts widget. Keep in mind that each theme is unique, thus, even if your theme has the same capability, it may be under a different name.

Step 2: Customize the Widget

In my case, I am using the ColorMag them which is full of helpful widgets that are exclusive to the theme.

Featured Posts

Step 3: Save Changes

This widget allows you to choose how many posts to display and will show the title, thumbnail, and a small excerpt. You can customize it to your liking. Click on the “Save” button when you are done.

Save

In the case of ColorMag, you can place widgets on the Frontpage (homepage), thus you can put these featured posts on your home page, excerpt and all.

Other themes will provide a variable length to use as the excerpt. Usually, this is anywhere from 55 to 60 characters. However, you may be able to change the length by examining the settings of your particular theme.

If your them does not support this functionality, don’t worry, there are other ways to add an excerpt.

Method 2: Manually Writing An Excerpt

Step 1: Open a Post

WordPress actually provides you the option to write your own Excerpt. By default, WordPress will automatically use the first 55 characters of the post If you have not manually written one. If the content is too long, it will add an ellipsis (…) at the end.

If your brand new to WordPress, don’t feel bad about missing the excerpt option when writing posts, it’s easy to overlook.

Note: While the option to write your own excerpt is turned on by default in the Gutenberg editor, those using the classic editor will have to enable it through the Screen Options.

Create a new post or open an existing one.

Step 2: Open Settings

Click on the “Settings” button to open the post options.

Settings

Step 3: Expand Excerpt Option

You will now see a list of options for the post. Click on the Excerpt option to expand it.

Excerpt

Step 4: Add Your Excerpt

Here you can type your excerpt. Remember this is only supposed to be a small snippet of text. You can create an excerpt for all of your content, even if it has already been published. Keep it interesting, and make sure it’s a good indicator of what the post is about.

Note: Static pages, such as those used for a landing page, do not have access to an excerpt. This is because of the nature of the page when compared to posts. The system simply does not organize pages the same way as it does for posts.

Method 3: Adding Excerpts from the Admin Panel

Step 1: Locate the Correct File

Like most things in WordPress, you can also add some code to achieve the desired results. Once, again, this is theme-specific. Each theme stores information in different locations. Thus, the first step is to locate which file it is in.

The only way to do this is to explore each file and find the code related to excerpts. Typically the most common places to find excerpt code are in:

  • index
  • archive
  • category

While this may sound like a lot of work, it’s really not. Once inside a file, use CTRL + F to search for the following line of code:

Once you find the code, your in the right file. If not, consult your theme’s support page to find the correct location.

Step 2: Replace the Code

Before you make any changes to the code, I highly recommend creating a backup of your website. This will ensure that if a mistake is made, you can correct it.

Replace the code you found with:

Depending on your theme, you should now be able to enter excerpts from your admin dashboard.

Step 3: Change the Length of the Excerpts

One of the main advantages of choosing to edit the code is that you can also take this time to edit how excerpts function in WordPress. By default, WordPress uses a 55-character limit for excerpts. In some cases, your website’s layout may be able to support larger excerpts.

Thus, you may want to change the excerpt length.

You can change the excerpt information by editing the functions file within your theme. Simply copy and paste the following code into your functions file:

// Changing excerpt length

function new_excerpt_length($length) {
return 100;
}

add_filter('excerpt_length', 'new_excerpt_length');

// Changing excerpt more

function new_excerpt_more($more) {
return '...';
}

add_filter('excerpt_more', 'new_excerpt_more');

The only part of this code that you need to change is the “return 100;” line. This “100” refers to the character limit of the excerpt. Thus, this code will set it to a 100 character limit. Adjust the value to better suit your website.

It may take some trial and error to find the best fit for your specific layout.

Best WordPress Excerpt Practices

A common practice by many WordPress users is to let the system pull the first snippet of text from the post itself. This can save time, but it may not have a clear representation of what the piece is about. In this instance, you would have to make the topic clear within the first two sentences.

Some owners will copy the entire first paragraph as the excerpt. This is seen mostly in websites that are designed to handle a large block of text. In many instances, these paragraphs are less than 75 words long.

Another practice by many is to write the excerpt manually by briefly describing what the post is about. In reality, an excerpt can be anything you write.

Help Readers Find Your Posts

Showing the excerpt for your post can go a long way to engage your visiting audience. It gives them a chance to get a gist of the content and may help reduce “bouncing” in Google Analytics. Make it easier for your visitors to find your material and include the small things they may appreciate.

How many posts do you have delivered on your homepage? Do you write your own excerpts, or does WordPress make them for you?

1 thought on “How to Show a WordPress Excerpt in Your Theme”

  1. Hi Chris! Wow thank you for this article, it is so comprehensive! Unfortunately I’ve tried going into the “screen options” and checking off the “excerpt” box, yet my posts are still not showing up with excerpts on the individual pages… oh no! The only thing showing up is a square featured picture and the title of the post…

    Do you have any suggestions for how I can fix this/what I am doing wrong? Thanks!

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.