I’m working on a project, that requires people to add excerpt text in a page. By default excerpts are not enabled in WordPress for pages but there is a simple function you can add to your functions.php file to enable Page Excerpts.

Locate you functions.php file in your theme’s directory and add this line of code to it:

Now you will see the Excerpt box below the Content box on your pages. For more information about the add_post_type_support function, check out the WordPress Codex. Have fun!

21 Comments

  1. Very interesting i couldn’t find this simple hint on wordpress.org website. But, one problem I added this an it just doesn’t work. At all. Did I do something wrong? I just copy/pasted this line into my functions.php file. What do you think the issue could be?

    Thanks!
    jC

  2. Okay. Cool. Figured it out!

    The code that’s up there, when you copy/paste it in, it gives you the wrong character codes for ‘page’, ‘excerpt’

    So, I replaced those and it worked!

    Hope that helps!
    – JC

  3. not working for me though i took care of the quote and added a hook as mentioned in the codex

  4. Karol,

    If you’re using WP 3.0 or greater, it should work fine. But you may have some code somewhere removing the support too. It’s hard to say without looking at your setup.

    Lew

  5. Better do it this way:

    if ( function_exists(‘add_post_type_support’) )
    {
    add_action(‘init’, ‘add_page_excerpts’);
    function add_page_excerpts()
    {
    add_post_type_support( ‘page’, ‘excerpt’ );
    }
    }

  6. Thanks for teaching how to add excerpt manually. Another simple way to add or activate excerpt is to simply go to “Add New Post option” then go to “Scree Options” (lying next to “Help”) and tick the Excerpt box. You’re done.

    1. In Edit mode of page, the Excerpt option doesn’t exist on Screen Options by default, so adding the code into functions.php is necessary

  7. I’ve come across plenty of websites explaining this code and it does work, but no one explains how to actually get it to display on a page. I’ve tried the_excerpt() and get_the_excerpt() as I want to just display it below the content on certain pages, but I can’t get it to display anything, despite text being present and saved in that box.

    1. Hi Matthew,

      I just tested this on one of my development site, seems to be working fine for me w/ the_excerpt(); Make sure you’re adding the function to the properly theme template.

  8. I could not get it to work with my theme. Spent almost an hour on it. It kept displaying the title of my site, despite me not calling the_title(). I ended up just creating a custom field, entering my own personal message, and calling it that way.

  9. kills the php..

    if (have_posts()) : while (have_posts()) : the_post();
    h1 class=”page-title”>the_title(); /h1
    the_content();
    the_excerpt(); <-right where i want it — after the content
    endwhile;
    endif;

Leave a Reply

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.