Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

hey guys, I have no idea how to solve the following problem. I'd love to have a page-template that lists all it's child-pages but with the content.

e.g. Imagine I have a page called "WORK. And "Work" has childpages like "Work 01", "Work 02", "Work 03", etc.

I don't just want "WORK" to list the names of the childpages as a navigation, but rather just show all the pages under each other!

Any idea how to solve that? Thank you.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You would need to create a page template and query those pages directly.

                    $args = array(
                    'post_type' => 'page',
                    'post__in' => array(430,436,433), //The Page IDs you want to query
                     'order'    => 'ASC'
                        );

                $page_query = new WP_Query($args);

If you wanted to do this automatically and get the child pages of the current page you could use something like this:

<?php
// Set up the arguments for retrieving the pages
$args = array(
    'post_type' => 'page',
    'numberposts' => -1,

// $post->ID gets the ID of the current page
'post_parent' => $post->ID,
    'order' => ASC,
    'orderby' => title
    );
 $subpages = get_posts($args);
 // Just another WordPress Loop
 foreach($subpages as $post) :
    setup_postdata($post);
 ?>
<h4><?php the_title(); ?></h4>

 <?php the_content(); ?>

 <?php endforeach; ?>
share|improve this answer
1  
thank you, just perfect. –  mathiregister Apr 30 '11 at 9:27

Your Answer

 
discard

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.