Hello.
It would be great if someone have input on how I could solve the following problem. I have searched the forum for a while without finding an answer to my problem. I want to output the content of the subpages on the parent page.
The code I'm using is the following:
<section class="grid_8">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
$pageID = $wp_query->post->ID;
?>
<article>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
</article> <!-- close the article -->
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</section>
<?php
//the missing link....
?>
<?php if($subpageID>>'0'):?>
<aside class="grid_4">
<?php $child = new WP_Query('page_id=' . $subpageID); while ($child->have_posts()) : $child->the_post(); $do_not_duplicate = $post->ID; ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
</aside>
The thing I need help with is "the missing link". How to get all the subpage ID's from the original loop?
Is there a better way to do this?