Skip Navigation

[Resolved] Display fields of a post related to the current post with ACF post relationships

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

Problem: I would like to use Toolset shortcodes to display information about a post that is related to the current post by an ACF post relationships field.

Solution: To use Toolset shortcodes to display information about another post, you must know the post ID. Then you can pass that post ID into the Toolset shortcode. To get the related post ID, you might need assistance from the ACF support team.

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/

This support ticket is created 6 years, 3 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by fabienG-2 6 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#1143094
Capture.JPG
Capture2.JPG

Hi,

I have a custom post type "petit groupe", I created a view ("View Guide dans listing En petit groupe") to list them it's work well.
In this CPT I have an ACF dropdown to choose the related CPT "guide".
So I would like to display somes fields of the CPT "guide" in the view ("View Guide dans listing En petit groupe")
This fieds are for example in the second screenshot: the title, sous-titre, image etc...
Thanks a lot

#1143260

You can use the "id" attribute in any Types or Views shortcode to get information from another post. For example, the post title of a Guide post with ID 12345:

Post title: [wpv-post-title id="12345"]

To display the value of an ACF field with the slug "sous-titre" from Guide post 12345:

Sous-titre field: [wpv-post-field name="sous-titre" id="12345"]

In this CPT I have an ACF dropdown to choose the related CPT "guide".
I do not know exactly how post relationship works in ACF, so you may need assistance from their support team. If you want to display information about a different post using Types or Views shortcodes, you must know the post ID. I do not know how to get the post ID from an ACF related post field. If it's just the dropdown field value, then you might be able to do something like this:

Post title: [wpv-post-title id="[wpv-post-field name='guide']"]<br />
Sous-titre field: [wpv-post-field name="sous-titre" id="[wpv-post-field name='guide']"]
#1145669

My issue is resolved now.
Thanks a lot!