WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I inserted an excerpt into a Page using the "More" button in WP GUI.

I have a custom loop-page.php from which I want to display the excerpt. But it appears to be empty?

Is it possible to display excerpts from child pages?

$pageChildren = get_pages('sort_column=menu_order&hierarchical=0&child_of='.$post->ID);
if ( $pageChildren ) {
  foreach ( $pageChildren as $pageChild ) {
    echo '<p>And the title is: '. $pageChild->post_title.'</p>';
        if (!empty($pageChild->post_excerpt)){
            echo '<p><a href="' . get_permalink($pageChild->ID) . '">' . $pageChild->post_excerpt.'</a> </p> ';
        echo '<hr />';

enter image description here

share|improve this question
up vote 2 down vote accepted

Using the "more" tag does not create an excerpt. It simply creates a "Read More" link when displaying the_content() on index pages.

Excerpts are created/displayed as follows:

To display an excerpt, your template file needs to call "the_excerpt()" rather than "the_content()". Note: you use the equivalent $post->post_excerpt, which should also work just fine.

The "the_excerpt()" template tag then displays the excerpt, which is created as follows:

1) By entering excerpt content into the "Excerpt" field on the Edit Post/Edit Page screen. 2) Automatically, based on number of characters, if no content is added to the "Excerpt" field.


Okay so I totally missed this at first. Only Posts have the "excerpt" field. Pages don't have the "excerpt" field. So, $post->post_excerpt will never be populated for Pages (I think).

Try running "setup_postdata( $pageChild )" inside your foreach loop, and then replacing "$pageChild->post_excerpt" with "get_the_excerpt()":

foreach ( $pageChildren as $pageChild ) {
    setup_postdata( $pageChild );
    echo '<p>And the title is: '. $pageChild->post_title.'</p>';
            echo '<p><a href="' . get_permalink($pageChild->ID) . '">' . get_the_excerpt() .'</a> </p> ';
        echo '<hr />';

Does that work?

share|improve this answer
Hi Chip. I understand excerpts now, but I can't find where they are entered. I added a screenshot of what I see when editing a post. There doesn't appear to be an "excerpt" area. This is why I thought 'more' was 'excerpt' – mrtsherman Mar 28 '11 at 18:41
I don't see the screenshot, but I suspect the issue is that the "Excerpt" field isn't enabled. From your Post Edit screen, click the "Screen Options" tab in the upper right-hand corner, and ensure that the checkbox for "Excerpt" is enabled (checked). – Chip Bennett Mar 28 '11 at 18:44
I guess my theme doesn't have excerpt built in. When I click screen options there is no checkbox or area for excerpt. – mrtsherman Mar 28 '11 at 19:06
My mistake. Pages don't have $post->post_excerpt. I updated my answer with another suggested fix. – Chip Bennett Mar 28 '11 at 19:15
You can add excerpts to Pages like this (call this on init): add_post_type_support( 'page', 'excerpt' ); – goldenapples Mar 28 '11 at 20:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.