I have enabled the excerpt feature for pages in my wordpress theme –
add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
This has enabled the excerpt box when adding or updating pages through the admin area, which is what I expected.
I am then trying to display each excerpt on the homepage of my site like so –
$child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = 64 AND post_type="page" ORDER BY post_title", 'OBJECT'); ?>
<?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<div class="memberHover" id="member-<?php echo $pageChild->ID; ?>">
<div><h4><?php echo $pageChild->post_title; ?></h4>
<p><?php the_excerpt(); ?></p>
</div><?php echo get_the_post_thumbnail($pageChild->ID, '312,156'); ?>
</div>
<?php endforeach; endif; ?>
The issue is that even if I have a manual excerpt populated through the admin area, it still creates the auto excerpt when displaying on the homepage. It seems that it is not picking up the fact that there is a custom excerpt in the database for each item.
Any and all help is greatly appreciated!
Thanks,
Tristan