Title: NelutuO's Replies | WordPress.org

---

# NelutuO

  [  ](https://wordpress.org/support/users/nelutuo/)

 *   [Profile](https://wordpress.org/support/users/nelutuo/)
 *   [Topics Started](https://wordpress.org/support/users/nelutuo/topics/)
 *   [Replies Created](https://wordpress.org/support/users/nelutuo/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/nelutuo/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/nelutuo/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/nelutuo/engagements/)
 *   [Favorites](https://wordpress.org/support/users/nelutuo/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Post type tree loop](https://wordpress.org/support/topic/post-type-tree-loop/)
 *  Thread Starter [NelutuO](https://wordpress.org/support/users/nelutuo/)
 * (@nelutuo)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/post-type-tree-loop/#post-5931863)
 * 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

Viewing 1 replies (of 1 total)