Add Excerpt to Pages

Sometimes it’s handy to utilize the same features that are available within the Posts area, inside of your Pages. Adding the Excerpt to the Pages, provides you with an additional, native field to pull data from and take advantage of when building your WordPress website.

Simply drop the below code into your functions.php

add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
     add_post_type_support( 'page', 'excerpt' );
}

Sourced here.

To avoid having to use the_loop to display the_excerpt(); data, try the following to display excerpt content by id:

$id = 33;  // id of the post or page for the excerpt you're trying to display
$temp = $post;
$post = get_post( $id );
setup_postdata( $post );

echo get_the_excerpt($post);

wp_reset_postdata(); $post = $temp;

This method also works to retrieve post content by ID.

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.