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

What do I need to do to display thumbnail + tags + title of a child page?

[ Thumbnail ]

[ Title ]

[ Tags ]


EDIT: Well this work, but only showing thumbs+title... it shouldnt be too difficult to add the tags:

    $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="child-thumb">
     <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"> <?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?></a><br />
     <a href="<?php echo  get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a><br />
    <?php endforeach; endif;
share|improve this question
I've added the 1st post with the code – Phife Dawz Jun 6 '12 at 19:48
Did you enable post-type support for post_tags, for Pages? – Chip Bennett Jun 6 '12 at 19:53
Yupp! The tags works on pages, so no problem there! :) I tried to add <?php echo get_the_tags($pageChild->ID); ?>, but that generates the word Array on the parent page.. – Phife Dawz Jun 6 '12 at 20:07
up vote 0 down vote accepted

Assuming that you've enabled support for both post thumbnails and post tags for static Pages, I would use WP_Query() to build your query, and do something like the following:

global $post;
$child_pages_query_args = array(
    'post_type'   => 'page',
    'post_parent' => $post->ID,
    'orderby'     => 'menu_order'

$child_pages = new WP_Query( $child_pages_query_args );

if ( $child_pages->have_posts() ) : while ( $child_pages->have_posts() ) : $child_pages->the_post();
    <div class="child-thumb">
        <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <?php the_tags(); ?>
endwhile; endif;

// Be kind; rewind

Note that I've not included any failsafes, such as checking for has_post_thumbnail(), etc.

share|improve this answer
Wonderful! Works great! – Phife Dawz Jun 6 '12 at 21:12
Glad to help! Be sure to accept the answer, by clicking the checkmark beneath the voting buttons, if it solved your issue. :) – Chip Bennett Jun 6 '12 at 21:16

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.