1. Home
  2. WordPress Tutorials
  3. How to Show a WordPress Excerpt in Your Theme

How to Show a WordPress Excerpt in Your Theme

wordpress excerpt

Excerpts are small snippets of an article that are 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 in 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.

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 include the excerpt.

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

Step 1: Go to the appearance area of your WordPress admin panel.

go to appearance

Step 2: Click on the option available for “Widgets.”

click on widgets

Step 3: Scroll down until you see something which controls posts. For example, both ColorMag and ColorNews use a widget called, “Featured Posts.” This widget lets you show a determined number of posts from any category while displaying the excerpt.

featured post a

From here, you can add the widget to the homepage or perhaps drop it into a sidebar. The options available will be determined by the type of theme you are currently using.

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.

Turning On Excerpts While Writing a Post

When you don’t type in a manual excerpt, WordPress will automatically use the first 55 characters of the post. If the content is too long, it will add an ellipsis at the end.

That’s the “…” you see everywhere on the Internet. It signifies there is more content related to the excerpt.

To turn on the window in a post so you can create your own excerpt:

Step 1: Create a new post or open an existing one.

Step 2: Near the top right, you’ll see a tab labeled, “Screen Options.” Click this tab.

screen options

Step 3: The tab will scroll down and reveal a series of check boxes. From here, you can click the box for the excerpt.

click excerpt

Step 4: This will add a new window at the bottom of your WordPress editor. Scroll all the way down until you see the text field available under, “Excerpt.”

excerpt editor

OPTIONAL: If you don’t want this window at the very bottom of the editor, you can hold down left-click on the top of the “Excerpt” window, drag it up and drop it anywhere you wish in the WordPress editor. Some people will place it directly under the primary content section.

WordPress will automatically save this setting. You won’t have to go into the screen options to turn it on again in the future.

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.

Adding Excerpts from the Admin Panel

NOTE: Always save a backup copy of any and all files you wish to edit. This will save you from a great deal of aggravation and stress should something go wrong.

For those who add content directly from the admin panel, you can turn on the ability to include an excerpt by modifying a few files in your WordPress theme. Using the editor function within the appearance area of the WordPress admin panel, find the following files in your theme’s folder:

  • index.php
  • archive.php
  • category.php

Not all themes will have these files. In that case, only access the ones you do have.

Find this line of code in each of your files:

“<?php the_content(); >”

content code

Replace it with this:

“<?php the_excerpt(); >”

excerpt code

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

Changing the Length of the Excerpts

Some layouts may simply look better if you could go beyond the 55-character limit WordPress has on excerpts. There may be a couple of ways you can modify this number to suit your design needs.

In the Code

functions code

Open your functions.php file using a text editor. If you do not have software for editing code, Notepad can be used if you have a Windows operating system.

Add the following code to the 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’);

 

Take note of the area for “return 100.” This will be the new number of characters displayed as the excerpt. This can be any number you wish, in reality. However, you don’t want it to be too large as it could offset your theme’s design.

In Your Theme

Some themes give you the option to change the excerpt length whether it’s located in the customizer or in a built-in widget. Others may not have a limit and will let you use any length you wish. For example, the ColorMag and ColorNews themes don’t use the 55-character limit and don’t need the above code.

Best 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.

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?

Author: Chris Racicot

Chris is the Support Manager at GreenGeeks and has been with the company since 2010. He has a passion for gaming, scripting and WordPress. When he’s not enjoying his sleep, he’s working on his guitar skills and fiddling with 3d printing.

Updated on March 6, 2017

Was this article helpful?

Related Articles

Comments

  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!

Add A Comment