Skip Navigation

[Resolved] Showing Parent details on child post – Post relationships

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

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/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Paul 10 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#36826

Hi there, I have a fairly simple problem that hopefully will be easy to fix but it's beaten me so far!

-> I have created a property website
-> I have Agents setup as a custom post type and Access Role
-> I have Properties setup as a custom post type
-> Agents are parents of Properties post types
-> I have setup this Post Relationship in Views

Here's the problem:

-> I have setup up a View for a single Properties Details page for individual properties
-> I have setup a View for Agents details including Logo, contact details etc.
-> I want to show the Agent Details View on any Property Child post belonging to each agent
-> Noting that Agent is parent to Property child

So I guess it's kind of like your Tutorials section on your website as Tutorial Parts are children of the main tutorial. I just need this in reverse to show the parent.

Thanks

Paul

#36864

Hi Paul,

Here is a document about "Displaying Fields of Parent Pages":
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

To include a field from the parent post, you would use the following shortcode:
[types field="xxxx" id="$yyyy"]
Where xxxx is the field of the parent you want to show, and yyyy is the slug-name of the parent. The “$?? is required, as this represents a variable where the parent post name will be replaced by the post ID, internally.

If you enter $parent as the id, you will choose the WordPress parent.

Please let me know if you need assistance to do it

Regards
Luo

#36913

Hi Luoy,

Thanks very much for your great response, I knew there had to be a way to do it simply!

How would I go about creating a View for the Agent Details which I can use on these child (property) pages? I want to output several things like Agency Logo, Contact Details, etc which outputs on each Property Page....

Am I better off doing it as a Content Template and would I have to add the id="$..." for each field?

I've tried doing this like:

[wpv-view id="$agents" name="Agent Sidebar"]
[wpv-post-body id="$agent" view_template="Agent Property"]

But it just returns "No posts found"...I'm wondering if I have my View and filters setup wrongly?

Thanks so much for your assistance....

Paul

#36949

Hi Luo, can you take a look at my last comment - that would be great!

Cheers

Paul

#37011

Please try add the id="$…" for each field

#37435

Hi Luoy, sorry forgot to mention that sorted it! Thanks once again.

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