Skip Navigation

[Resolved] How can I get field from repeatable group inside post which has relationship?

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user would like to display fields in a repeatable field group of a related post.

Solution:
Repeatable groups need to be displayed using a view. And because you want to display the repeatable group from a related post you will need to create a content template too. The content template will be used to switch the context from the current post(bonus) to the related post(casino), and the view needs to be inserted inside this content template and hold a query filter on the relationship of the repeatable group. Does it make sense?

You will be able to display the content template by using the item attribute the same way it is used when you want to display a regular custom field.

[wpv-post-body view_template="the_content_template_name_or_slug" item="@casino-bonus.parent"]

Relevant Documentation:

This support ticket is created 3 years, 11 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.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Serhii 3 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#1908135

Hello, please help with next thing

My site - hidden link
Test page - hidden link

I have two post type "Casino" and "Bonus", this two post types have relationship between each other hidden link

-----

I have the bonus type post "70 Free spins From Riobet Casino" (hidden link). On this page I need to display information about casino which has relationship with this post.

And it's simple, I select the field I need and in the additional settings I indicate this - hidden link
I get shortcode like this [types field='casino-website' item='@casino-bonus.parent'][/types] and field displaed how I expected.

-----

But if I need to display casino field from repeatable group inside bonus post I get fail.

Please help me.

#1908325

Hello and thank you for contacting the Toolset support.

Repeatable groups need to be displayed using a view. And because you want to display the repeatable group from a related post you will need to create a content template too. The content template will be used to switch the context from the current post(bonus) to the related post(casino), and the view needs to be inserted inside this content template and hold a query filter on the relationship of the repeatable group. Does it make sense?

You will be able to display the content template by using the item attribute the same way it is used when you want to display a regular custom field.

[wpv-post-body view_template="the_content_template_name_or_slug" item="@casino-bonus.parent"]

Check the following articles:
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

I hope this helps. Let me know if you have any questions.

#1909417

My issue is resolved now. Thank you!