types_child_posts returns no values

With toolset types I’ve created a custom post type called “buch” which has a child post type called “cover-image”. When trying to render the data of a “buch”, I have success in displaying the parent posts (e.g. my custom post type “autor”) like that:

<?php $writer_id = wpcf_pr_post_get_belongs( get_the_ID(), ‘autor’ );
$writer_name = $writer_post->post_title;
?>

<div class=”writer”>
<h5>Author: <?php echo $writer_name; ?></h5>
</div>

However, when I try to access my post types children (the cover image) with that code:

<?php
$child_posts = types_child_posts(“buch”);
var_dump($child_posts);
foreach ($child_posts as $child_post)
{ ?>

<div class=”book-listing”>
<h5><?php echo $child_post->post_title; ?></h5>
<?php echo types_render_field( “cover-image”, array( “id”=> “$child_post->ID”, “size” => “thumbnail” ));
?>
</div>
<?php }

there’s nothing displayed. As you can see I tried to dump the $child_posts variable but that always returns 0, so somehow there are no children found.

Read more here:: types_child_posts returns no values

Leave a Reply

Your email address will not be published. Required fields are marked *