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 currently have 10 child pages which each contain one main image and text.

I then have the main parent page, which acts as a 'contents page'.

I currently have this code on the main parent page...

<ul class="treatments-list h3">
    <?php wp_list_pages('title_li=&child_of='.$post->ID=15); ?>

This gets all the titles for these child pages and lists them, however, I would like to add an image thumbnail at the start of each of these lists, how can I do this?

Thanks in advance.

share|improve this question
Is the image in the post body? – s_ha_dum Dec 24 '12 at 15:39
yes it is in the body – Adam Dec 24 '12 at 18:09

You can use get_pages to do that:

<?php $pages = get_pages(array('child_of' => get_the_ID())); ?> 
<ul class="treatments-list h3">
    <?php foreach ($pages as $page): ?>
            <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
                <a href="<?php echo get_permalink($page->ID); ?>" title="<?php echo esc_attr($page->post_title);?>">
                    <?php echo $page->post_title; ?>
    <?php endforeach; ?>
share|improve this answer
Thanks, I have tried this but it does not seem to work. I have added the additional code in functions also but the image does not appear – Adam Dec 24 '12 at 18:10

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.