I’m a beginner so what I have is very basic and may not help to much.
I have a basic loop and two variables that I thought may hold the key.
<?php $loop= new WP_Query( array( 'post_type'=> 'post-type', 'posts_per_page' => -1 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php echo $id = get_the_ID(); ?>
-
<?php echo $parent = $post->post_parent; ?>
<?php the_title(); echo "<br />"; ?>
<?php endwhile; wp_reset_query(); ?>
What I was trying to do but didn’t managed is this:
display the pages that have the parent equal to zero
check if the page is a parent
if it is -> loop and display the child pages
I don’t know if WP_Query can display the pages that have a specific parent (wich we know since we have its id) and I don’t know if a WP_Query can be used inside another WP_Query