Posted By

i-am-andy on 01/09/12


Tagged

get page wordpress content child


Versions (?)

Show list of Child pages and Featured Image on Current Page


 / Published in: PHP
 

URL: http://wordpress.org/support/topic/show-list-of-child-pages-of-current-page-w-featured-image

Show all child pages content and featured image on the parent page

  1. <?php
  2. $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY menu_order", 'OBJECT'); ?>
  3. <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
  4. <div class="child-thumb">
  5. <?php echo get_the_post_thumbnail($pageChild->ID, 'thumbnail'); ?>
  6. <a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a>
  7. </div>
  8. <?php endforeach; endif;
  9. ?>

Report this snippet  

You need to login to post a comment.