[resolved] Excerpt stripping pictures (4 posts)

  1. jami1955
    Posted 5 years ago #

    I have page children that I want to list as titles along with excerpts on the parent page. I have done it almost successfully with the following code coming after the <?php the_content(''); ?> on the parent page.

    The problem is the code ending in <? the_excerpt(); ?> is stripping the picture I have in the child page. Each child page has a picture from the attached gallery in the content before the <!-- more --> tag. How can I change this code so that picture is included instead of stripped out?

    <? $pageChildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID."	AND post_type = 'page' ORDER BY menu_order", 'OBJECT');	?>
    <? if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild ); ?>
    <h2 class="subpagetitle"><a href="<?php echo get_permalink($pageChild->ID); ?>"><?php echo $pageChild->post_title; ?></a></h2>
    <? the_excerpt(); ?>
    <? endforeach; endif; ?>
  2. esmi
    Forum Moderator
    Posted 5 years ago #

    Replace <? the_excerpt(); ?> with <?php the_content();?>

  3. jami1955
    Posted 5 years ago #

    Don't you love it when it's that simple...? wow.

  4. esmi
    Forum Moderator
    Posted 5 years ago #

    You're welcome. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic