Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Display Post Excerpts in WordPress Themes

Do you want to learn how to display post excerpts in your WordPress theme?

By displaying post excerpts instead of the full article on your blog, you can increase pageviews, reduce loading speeds, and create a better experience for your users.

In this article, we’ll show you how you can easily add post excerpts to your WordPress theme.

How to display post excerpts in WordPress themes

Why Display Post Excerpts in WordPress?

Post excerpts are commonly used on blog index and archive pages to avoid displaying the full text for every article on your WordPress site.

By default, WordPress will show full posts on your home page, blog page, and archive pages across your website. WordPress does have built-in support for displaying post excerpts, but not every theme will take advantage of this.

Using excerpts can help to speed up WordPress since only a portion of each article will be loaded.

Plus, it can increase your pageviews since your visitors will have multiple blog posts to choose from, instead of a single long post.

That being said, let’s show you how you can display post excerpts in your WordPress theme.

Check if Your WordPress Theme Supports Post Excerpts

Most popular WordPress themes will already come with built in settings to display excerpts of your posts.

You can find this in your WordPress theme settings panel, or by going to Appearance » Customize and then clicking the ‘Blog’ menu option.

Go to WordPress customizer click blog

This brings you to a screen where you can customize your WordPress blog and archive page settings.

Simply click the ‘Blog/Archive’ menu option.

Click blog and archive menu option

After that, scroll down to the bottom of the menu to the ‘Post Content’ section.

Then, click the ‘Excerpt’ button.

Turn on post excerpt option

That’s it! Don’t forget to click the ‘Publish’ button to save your changes.

This will enable post excerpts for your WordPress theme. Depending on the theme you’re using, the menu options might be slightly different.

Display Post Excerpts by Adding Code to WordPress

If your theme doesn’t have built-in support for post excerpts, then you’ll need to add it manually.

You can edit your WordPress theme files directly, but we recommend creating a child theme. That way, when you update your WordPress theme you won’t lose the changes you’ve made.

For more details, see our beginner’s guide on how to create a WordPress child theme.

Once you’ve created your child theme, you need to find the right template for the pages you want to display post excerpts. For most themes, this will be the home.php, content.php, category.php, and archive.php.

For help finding the right template file to edit, see our beginner’s guide to WordPress template hierarchy.

After that, you need to locate the following code in each of the files:

<?php the_content(); ?>

Then, you need to replace it with the_excerpt tag, like the code below:

<?php the_excerpt(); ?>

After you save your files, your post excerpts will display where the full article used to be.

Change the Default WordPress Excerpt Length

Once you’ve added post excerpts to your WordPress theme, you might want to change the post excerpt length. By default, WordPress will take the first 55 words of the post and add an ellipsis (…) to the end.

You can change this by adding code to your WordPress files. If you haven’t done this before, then see our beginner’s guide pasting snippets from the web into WordPress.

Then, you need to add the following code to your functions.php file, in a site specific plugin, or by using a code snippets plugin.

// 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');

This code changes the post excerpt length to 100 characters. You can change the ‘100’ to your preferred character length.

If you want even more options for customizing your post excerpts, then see our guide on how to customize WordPress excerpts with no code.

We hope this article helped you learn how to display post excerpts in WordPress themes. You may also want to see our guide on how to choose the best web design software and our expert picks of the best payroll software for small businesses.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

93 CommentsLeave a Reply

  1. for the plane these this is what worked for me – Go to the home page and clkick edit. Go to the block editor and click on the block – Blog Posts. You will seea setting which states ‘post control settings’

    There you can enable or disable the show excerpt setting

  2. Hi thanks for this. I don’t have those files in my child theme. If I just go ahead and do this in my parent theme, won’t it be erased if there is an update?

    • Correct, if you place it in your parent theme and the parent theme is updated your changes would be lost

      Admin

  3. Thanks for this post. I also want to ask for help on how to add padding around excerpt. I have added border lines around my excerpt; the problem is the excerpt is touching the borderlines. How do I add padding around the excerpts, preventing it from touching the borderlines? Thanks in advance.

  4. Hi their,
    I am using ‘Enlightenment’ theme but I have a problem that in my post I can’t see the short Post Excerpt ie it’s come blank. And this happened only with ‘Enlightenment’ this theme. Because same code I am using in other theme is working fine. So is anybody give me solution on this?

Leave a Reply to Trenton Miller Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.