I’m using the Advanced custom field plugin and having trouble showing custom fields of children in a loop. I tried this:
<?php <br /> $pages = get_pages(array('child_of' => $post->ID));
foreach($pages as $page)
{
setup_postdata($page);
$fields = get_fields(); print_r($fields);
}
wp_reset_query();
?>
When I put print_r($page)
in it says 1111 so that bit is working (as there’s 4 children items).
That code just prints the custom field names of the parent rather than the children, how can I show the children’s custom fields?
It should’ve been post instead of page, doh!
http://support.plugins.elliotcondon.com/discussion/43/show-page-children-or-subpages-with-custom-fields
Have you tried this?