Passer la navigation

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

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 4 years, 7 months. 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

Fuseau horaire du supporter : Africa/Casablanca (GMT+01:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par Serhii Il y a 4 years, 7 months.

Assisté par: Jamal.

Auteur
Publications
#1908135

Hello, please help with next thing

My site - lien caché
Test page - lien caché

I have two post type "Casino" and "Bonus", this two post types have relationship between each other lien caché

-----

I have the bonus type post "70 Free spins From Riobet Casino" (lien caché). 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 - lien caché
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!