Pulling excerpts from child pages on parent?
-
I have enabled custom excerpts on my pages with this function.
add_action('init', 'page_excerpts'); function page_excerpts() { add_post_type_support( 'page', 'excerpt' ); }
However, When I enter a data into the excerpt field I still have the content returning in the loop instead of the excerpt.
<?php the_excerpt(); ?>
What am I doing wrong here?
Do I need to do anything else to force the content to be pulled from the excerpt field on pages?Here is my full code
<?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?> <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?> <div class="grid_4"> <h2><a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php echo get_the_post_thumbnail($pageChild->ID, 'landing-page', array('title' => $pageChild->post_title ,'class' => 'post-image')); ?> </a> <?php echo get_the_excerpt( $pageChild->ID ); ?> <p class="seemore"><a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>">See More</a></p> </div> <?php endforeach; endif; ?>
Cliffnotes
- the_excerpt(); is returning the_content() of child pages
- Not sure how to fix this
- The topic ‘Pulling excerpts from child pages on parent?’ is closed to new replies.