I've got the first part working - toolset_get_related_posts is grabbing the correct IDs for the repeatable field groups:
$location_features = toolset_get_related_posts(
$post->ID,
'unique-features',
array(
'query_by_role' => 'parent',
'return' => 'post_id',
'role_to_return' => 'child',
)
);
But when I get to the second step, this doesn't seem to be working:
foreach($location_features as $location_feature) {
echo $location_feature;
echo types_render_field( "wpcf-feature-name", array("output" => "normal", "id" => $location_feature ));
}
The ID gets echoed by the first line within the loop (so it seems like the loop itself is fine), but the second doesn't do anything. wpcf-feature-name is the meta-key for that field according to what I see in the database.
Hi Waqar! Thanks for the response. I tried using the updated code you sent, but I'm still not seeing the field content echoed - attaching screenshots of what I see in the database for one of the posts in question and what's getting printed on the page. What else should I try?
During troubleshooting, I noticed that the "types_render_field" function is using the custom field slug with the prefix "wpcf-", which is only needed when using WordPress' native functions ( e.g. get_post_meta ).