WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excerpt stripping pictures (4 posts)

  1. jami1955
    Member
    Posted 3 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?
    thanks
    JSC

    <? $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 3 years ago #

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

  3. jami1955
    Member
    Posted 3 years ago #

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

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    You're welcome. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic