WordPress – Show custom fields of children on parent page

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).

Read More

That code just prints the custom field names of the parent rather than the children, how can I show the children’s custom fields?

Related posts

Leave a Reply

2 comments