Hi, I am trying to display post fields group in my templates. I do not wish to use Views, preferably with PHP. My questions are as following:
1) How do I display all custom fields (repeating groups included) by just using the Post Field Group ID (the ID that appears on the URL when editing the group)? So that I do not require to call out each custom fields in the group one by one.
2) If the above is not possible, how do I display a repeating field group in the Post Field Group using slug in PHP within an existing WP_Query loop?
Hello. Thank you for contacting the Toolset support.
Well - to query Repeating fields group items we have PHP API function which you should use now: toolset_get_related_posts()
For example:
global $post;
$child_columns = toolset_get_related_posts(
$post->ID, // the parent post
'columns-layout', // the RFG slug
'parent', // the RFG role in this relationship is 'child'
100, // the maximum number of results
0, // the offset
array(), // additional query arguments
'post_object', // return format
'child', // role to return
'',
'ASC'
);
By using toolset_get_related_posts(), I can retrieve the group ID but how do I retrieve the content of the field? Do I use get_post_meta() to retrieve the values or is there another function that can do so easily?