EDIT
Seems that I some how misunderstood you. I do think you are missing the point of the post_excerpt
.
When you create a new post or page (AFAIK for pages as well), you have the opportunity to create a manual excerpt in the excerpt meta box (to make it available, just enable it in screen options dropdown when in the add new/edit post/page screen). This manual excerpt (or user defined excerpt) that you enter in that meta box is saved under post_excerpt
, which you can then retrieve with $post->post_excerpt
. If that meta box is empty, ie, if you haven’t specified a manual excerpt, nothing will be returned
It does not work the same as the template tag, the_excerpt()
that creates an excerpt on the fly by using the content to create an excerpt, which BTW doesn’t work on pages.
Please check out WP_Post
post_excerpt
string
User-defined post excerpt
EDIT 2
If the manual excerpt meta box is not displayed, you can simply activate it with the following code
add_action( 'init', 'add_excerpts_to_pages' );
function add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
ORIGINAL ANSWER
Your usage of get_pages
here is wrong here. get_pages
is not intended for this use.
You should be using a custom query with either get_posts
or WP_Query
You can do something like this to display your pages and excerpts
<?php
// The Query
$the_query = new WP_Query('post_type=page' );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
the_title();
the_excerpt();
}
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();