[Resolved] Display parent field when showing single child post
This thread is resolved. Here is a description of the problem and solution.
Problem:
In a template that shows child posts, how to display the title (or other field) of the parent post?
Solution:
Insert the field in question using the Fields and Views button and use the Post Selection tab to specify which post should be the source for the field (e.g. the parent).
That will add an item attribute, something like:
[wpv-post-title item="@relationship-slug.parent"]
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.
Hi, I try to build a very complicated site and I think Toolset (And Elementor Pro) is the the right tool for this. So I apologize in advance for over using this support.
I have created 2 CPT on my Site : "Section" and "Channel"
This CPT are Parent of Standard WP Post. And they ARE NOT RELATED BETWEEN THEM
I created a Single Post Template using Elementor Pro.
My Goal is to Display the parent of the actual single post the user are viewing. Please look the screenshot to understand What I need. I think I can display it using Shortcode but I don't find the good one. I can use PHP too directly on elementor using a plugin that display PHP via Shortcode.
When you use the Fields and Views button to insert a field, you can use the post selection tab to specify that the source for the field should be something different than the current post, e.g. a related post from a Types relationship.
See the screenshot for an example where I am inserting a field from the parent Project post.
Note the item attribute, which specifies the slug of the relationship and the part of the relationship, i.e. the parent, which should be the source for this field.
The problem you have working with Elementor is that we can't control the UI for Elementor templates and you don't have the Field and Views button available to you.
The shortcodes should still work in contexts where shortcodes are accepted (e.g. the text module or the shortcode module), but you need to enter the shortcode manually, or by copying and pasting from a backend edit screen where you had the Fields and Views button available.