This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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?