Skip Navigation

[Resolved] How can I display information from a post reference in a view

This support ticket is created 3 years, 4 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
- 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: Asia/Karachi (GMT+05:00)

Author
Posts
#1857075
schema.png

I have the following data structure: (see schema.png)

I created a view of the job-description-job-list relationship. Is it possible to get the id of the guide (post reference) for each job description in the view?

#1857425

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

content-template-step-1.png
content-template-step-2.png
content-template-step-3.png

Hi,

Thank you for contacting us and I'd be happy to assist.

From the screenshot, I understand that you have these 3 custom post types:

1. Job List
2. Job Description
3. Guide

And these relationships:

1. A many-to-many relationship between the "Job List" and "Job Description", where the "Job List" is the parent and "Job Description" is the child.
2. For the "Job Description" post type, you've included a post reference field that links to the "Guide" post type.

If my understanding is correct, you can follow these steps to get the related "Guide" post ID, in the view that shows the Intermediary posts for the "Job List" and "Job Description" relationship:

1. Please create a new content template (for example "show related guide post ID") and don't assign it to any post type or page.
( from WP Admin -> Toolset -> Content Templates )

In this content template, you can insert the post ID shortcode, but selecting the "Guide" post as a source from the post reference field.
( please refer to attached screenshots for the detailed steps )

2. Once this content template is ready, you can include this content template in your view's loop, like this:
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body )


[wpv-post-body view_template="show-related-guide" item="@job-list-job-description.child"]

Please note, how I've used the item attribute to set the source of the content template to the related child from the current association, which in this case is the related "Job Description" post.
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/ )

In the above shortcode, you'll replace "show-related-guide" with your actual content template's slug and "job-list-job-description" with the actual relationship slug.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1857981

It works like a charm, thank you.

I would have never thought of using this method on my own, great tutorial.

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