Skip Navigation

[Resolved] Repeating fields in Intermediary Posts

This support ticket is created 4 years, 9 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 2 replies, has 2 voices.

Last updated by Guillaume 4 years, 9 months ago.

Assisted by: Nigel.

Author
Posts
#1289451

Hello,

I have a website with a many to many relationship.

House } Kind of room : Parent and Child

Number of this kind of room in the house : my relationship field

Fourniture / Fourniture Year : repeating fields group of the Kind of room

---

My goal is to show in the house post a list (sorted by number of kind of room )of the kind of room with the list of furniture per kind of room.

I succeeded to show the childs in the parent post and listed by the number of kind of room by using a view who display the Intermediary Posts

I've created a view to display the repeating fields group and it work if I insert this view in another view who display the kind of room.

The view is not working anymore when I insert it inside my Intermediary Posts view I build previously.

Is there a special formating ?

Thanks

#1289509

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Screenshot 2019-07-11 at 12.33.29.png

Hi there

To recap the structure you described, you have a many-to-many relationship between House and Kind of Room types, and there is a repeating field group (with fields furniture and furniture year) belonging to the Kind of Room posts.

The m2m relationship has an intermediate post type to store relationship fields.

Visually, the relationships look something like this:

house  << intermediate >> kind of room
                               |
                               |
                         furniture RFG

When displaying the house post you are able to list the connected kind-of-room posts ordered by the number of such rooms by using a View which queries the intermediate post type with a filter for the related house post.

You want to display the furniture RFG fields for each kind of room output by the previous View.

The problem is that the previous View is not iterating over kind-of-room posts, it is iterating over the intermediate posts (but outputting fields from the kind-of-room posts using the item attribute to switch source).

So when you insert the second View—to display the furniture RFGs of a house—we need to tell the View the kind-of-room post which should be used as the owner of the furniture RFGs instead of the intermediate post type which is the current post in the parent View loop.

In my screenshot you can see the Query Filter for the View to display RFGs, I'm telling it to get the ID of the post the RFGs belong to from a shortcode attribute (wpvrelatedto by default, though you can change this).

Then in the parent View where you insert his View using a shortcode, you provide the id of the related kind-of-room post rather than the intermediate post, e.g.

[wpv-view name='whatever' wpvrelatedto="[wpv-post-id item='@relationship-slug.child']"]

Can you follow that and give it a try?

#1289601

My issue is resolved now. Thank you!
Great, without you I couldn't find this solution.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.