I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so:
<?php
$loop = new WP_Query( array(
'post_type' => 'programs',
'posts_per_page' => -1,
'post_parent' => 0
) );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
loop stuff
<?php endwhile; ?>
Within each loop, I need to to do another loop, which shows all of the children of that post that is currently being iterated on.
The point is to show each post, and then all of the children of that post underneath it. I need to loop through the children pages so I can show the title, content, image, custom fields, etc. I do not know how to approach this, as using a QP_Query loop inside another leads to unexpected results. Any ideas?