Skip Navigation

[Resolved] Display parent within a loop view of related posts

This support ticket is created 4 years 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 4 replies, has 2 voices.

Last updated by pieterV-2 4 years ago.

Assisted by: Jamal.

Author
Posts
#2141801

I have a template of a certain type (concerts) and within that I have a view of related (many-to-many) posts of the type adverts.

The advert type has a parent type of "journal". When I'm on an advert, I can chose to display the parent.

However, when I try to add a field within the view I can't select the parent to display the journal of the advert. How can I solve this?

#2141803

It seems that, additionally to this problem of not being able to retrieve the parent, I also cannot retrieve some of the custom fields.

I have custom field group (reference) for the advert's issue number and pagination. Within the view, I can only select the custom field group the types advert and concert both share (date).

#2141905

And another item I observed is that when building a template (archive) for the journals, I also can't access the custom fields of the adverts (journal and adverts are in a one-to-many relationship).

Is this a bug on the frontend part? Because when you're in the view loop, and you want to add a field, it still seems to point towards the other part of the relationship, even though within the loop you're on a different entity.
For example, within the journal template I have a view to loop on adverts of that journal. But when adding a single field, the Post Source Field only gives the options "Current Journal" or "Other post".

I assume that if this would relate to the correct type, probably most of my issues would be fixed in one go.

#2142127

Hello and thank you for contacting Toolset support.

I assume that you are using the blocks editor to build the archive, right?
Make sure that the field group is assigned to both custom post types. If that does not help, create a content template per custom post type, and add a low priority for it, so it does not get used. Inside these content template try to display the custom fields from the parent post, and once it is done, convert those blocks to reusable blocks, then use them again inside the archive template.

You can also display the data using a Fields&Text block, the views button will help you display the custom fields from the parent post type.

If you are still stuck and can't display the parent post's custom fields, allow me temporary access and let me know what custom fields, and on what archive template, and I'll do it for you and share with you screenshots on how to do it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2143447

Using the Field & Text block solved the issue.