I have a custom post type with two levels of pages inside of it. the parent level we’ll call parent, and child – child.
The parents need to be able to pull in their children, and the children need to be able to pull in their siblings (children of the same parent.)
If i were doing this in a normal page:
<?php $children = get_pages('child_of='.$post->ID);?>
if( count( $children ) != 0 ) { ?>
<section class="children">
Give us your Children
</section>
<?php }
else { ?>
<section class="siblings">
Give us your siblings
</section>
<?php } ?>
Of course – this doesn’t work since get_pages only works with non-cpt “pages”. I’m at a loss for the proper method inside a CPT – help much appreciated.
get_pages()
works with other post types just fine, you only need to passpost_type
you want as part of argument (also I recommend to stick with array notation).