Query Child Pages of a Current Page and Loop Through Each Child Page
-
First of all sorry for the long title. I am currently using the code below to display a list of child pages or a specific parent page (in this case parent page_id 7) and then show thumbnails from a custom field attached to each parent page.
<?php query_posts(array('showposts' => 20, 'post_parent' => 7, 'post_type' => 'page')); while (have_posts()) { the_post(); ?> <div class="blind-subpage"> <?php if ( get_post_meta($post->ID, "articleimg", true) ) { ?> <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "articleimg", true); ?>&w=120&h=120&zc=1" alt="<?php the_title(); ?>" /></a> <?php } else { ?> <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php bloginfo('template_url'); ?>/images/blinds-subpage-image.jpg&w=120&h=120&zc=1" alt="<?php the_title(); ?>" /></a> <?php } ?> <!-- closes blind-subpage --> </div> <?php } ?>
What can I put in place of the ‘post_parent=7’ so that it will do this for the current page you are on? It is probably really easy and sorry if I am being thick here!!
Thanks in advance.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Query Child Pages of a Current Page and Loop Through Each Child Page’ is closed to new replies.