Skip Navigation

[Resolved] Displaying Intermediary Post Fields in Content Template

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

Problem:
How to display intermediary post type custom field value

Solution:
You should use Types shortcode with "item" attribute to display intermediary post type custom field value.

For example:

[types field="research-role" item="@intermediary-post-type-slug.association"]

Where:
- Replace "intermediary-post-type-slug" with your original intermediary post type slug.
- In a View, you should use @intermediary-post-type-slug.intermediary, not @intermediary-post-type-slug.association, to prevent ambiguity

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/displaying-intermediary-post-fields-in-content-template/#post-910645

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

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

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by Suzanne Wenger 5 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#910634

Tell us what you are trying to do?
I have created a template for a custom post type "Seed Grant". This is connected to "People" post type via many-to-many relationship. There is an Intermediary Post type "Seed Grant Participants" that has a relationship field of "role". This field defines the role a person plays within the seed grant (ie, principal investigator, co-investigator, etc...)

In my template I am pulling in the post body text and person name with a link to the person's page, and this is all working great...but when I try to list the intermediary post field, "role", in the content template, it comes up blank. I have tried to import this field multiple ways, read your documentation, but I just can't seem to get any information to show up on a page from this intermediary post field ("role").

Not sure what I am doing wrong, any suggestions would help. This is the shortcode I am using currently for trying to display this field:

[types field='research-role' separator=', ' item='@seed-grant-participant.child'][/types]

What is the link to your site?
hidden link

#910645

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - what if you try to use following shortcocde to display intermediary post type custom field. :

[types field="research-role" item="@seed-grant-participant.association"]
#910646

Thanks so much for the quick reply!

I tried the suggested code and it's still coming up blank...here's a page for an example: hidden link

The blank part is before the ": Matthew C. Spitzmueller". It should say "Principal Investigator: Matthew C. Spitzmueller"

Here's my template code:

<strong>[types field="research-role" item="@seed-grant-participant.association"]: <a href="[wpv-post-url item="@seed-grant-participant.child"]">[types field='firstname' item='@seed-grant-participant.child'][/types] [types field='lastname' item='@seed-grant-participant.child'][/types]</a></strong>[wpv-post-body view_template="None"]

Thanks for your help,
Suzanne

#910648

Hey, just noticed an error in my code, sorry for that. I forgot to close it with "[/types]". It's working great now, that fixed it!

Thanks!!!
Suzanne

#910655

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that the code I shared works for you. Would you mind to close the ticket with happy face 🙂

#910659

🙂

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