Easily Add “Excerpt” Support for Pages in WordPress

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!

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. Hi JC,

    It probably used smarty-quotes… I’ll fix it so it doesn’t.

    Thanks!

  4. Thanks, works great. Simple and useful.

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

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

  7. Christoph says:

    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’ );
    }
    }

  8. Thanks for this, I was searching on how to add the excerpt to my wordpress fucntions. Thanks

  9. Darren says:

    Excellent, thanks for the solution!

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

    • Chung Xa says:

      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

  11. Just wondering how to add excerpt to a specific page instead of all pages?

  12. Hi! How i add the excerpt in the post page? Thanks!

  13. emarten says:

    Works great for me, thanks!

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

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

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

  16. 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;