Easily Add “Excerpt” Support for Pages in WordPress

July 1st, 2010  |  Published in Mind  |  11 Comments

If you found this post, useful, please consider donating 1$ to help fund my and my wife’s adoption… click here for details.

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:

add_post_type_support('page', 'excerpt');

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!

Tags: , ,

Responses

  1. yetimade says:

    October 13th, 2010 at 09:47 AM (#)

    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. yetimade says:

    October 13th, 2010 at 09:50 AM (#)

    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. Lew says:

    October 13th, 2010 at 10:26 AM (#)

    Hi JC,

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

    Thanks!

  4. web-developer says:

    April 18th, 2011 at 09:27 AM (#)

    Thanks, works great. Simple and useful.

  5. Karol says:

    May 29th, 2011 at 05:43 AM (#)

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

  6. Lew says:

    May 29th, 2011 at 09:12 AM (#)

    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:

    October 9th, 2011 at 04:30 PM (#)

    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. Popcorn Design says:

    October 17th, 2011 at 06:19 AM (#)

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

  9. Darren says:

    February 25th, 2012 at 01:04 PM (#)

    Excellent, thanks for the solution!

  10. Quang says:

    March 4th, 2012 at 04:57 PM (#)

    It works well. Thanks.

  11. officer says:

    April 10th, 2012 at 01:19 PM (#)

    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.

Leave a Response