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
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
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
Hi Luo, can you take a look at my last comment - that would be great!
Cheers
Paul
Please try add the id="$…" for each field
Hi Luoy, sorry forgot to mention that sorted it! Thanks once again.