Be Studios

Intercontinental Design Firm

This is our knowledge center. Enjoy!

Get Children Posts from Custom Post Type

I'm sure all if you know how to get children posts from current page/post or any one with it's ID:

<?php
  $children = wp_list_pages('title_li=&child;_of='.$post->ID.'&echo;=0');
  if ($children) { ?>
  <ul>
  <?php echo $children; ?>
  </ul>
<?php  } ?>

But, why it doesn't work when using a custom post type? Well, the answer it's easy: add the custom post type name to the wp_list_pages argument:

<?php $children = wp_list_pages('title_li=&post;_type=POSTTYPENAME&child;_of='.$post->ID.'&echo;=0'); ?>

Link: Function Reference/wp list pages | WordPress.org Codez