Show excerpts in WordPress pages

By default, WordPress doesn’t include excerpts in pages. That’s quite reasonable since pages are made to be different than posts. But in some cases, you’ll need excerpts in your pages as well.

Since there is no easy way of allowing this, i.e. there is no checkbox which you can simply click to enable excerpts for pages, we will show you the second easiest way of doing that.

No, you won’t be needing a plugin nor you’ll have to go into detailed setups. In the following lines, we will show you a really short function which will do the job for you.

Show Excerpts in pages:

  1. Open functions.php
  2. Copy and paste the code snippet:
  3. function wploop_pages_excerpt() {
    add_post_type_support( 'page', 'excerpt' );
    }
    add_action( 'init', ' wploop_pages_excerpt' );
  4. Save changes

It’s definitely not as simple as clicking the checkbox but it wasn’t much harder than that, wasn’t it? Now that you’re done with copying the code, you can navigate to any page to test the feature.

Most probably you won’t have the excerpt shown below the page content. But don’t worry – you only need to allow excerpt to be displayed on the page:

  1. Scroll on top of the page
  2. Find “Screen options” tab and open it
  3. Find the “Excerpt” checkbox and mark it

Well, it seems like there was checkbox included in the process all the way.

You can now scroll down and write excerpt for your page. Code snippets like this one can really help you a lot, right?

Since you’re already working with excerpts, you might be interested in changing excerpt length or control excerpts with a plugin.

START YOUR OWN BLOG

This guide is an introduction to mastering the art of blogging. It provides easy to follow steps to start, maintain, and grow your blog.

Read the guide

Leave a Reply

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