Skip Navigation

[Resolved] How can I return the name of the parent post for each of my loop results?

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

Problem:
The user was unable to display a parent post title in the frontend.

Solution:
The user most probably did not choose the correct relationship in the popup window, that's why he was getting only "$parent" in the item attribute. The popup should return "@{relationship-slug}.parent".

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

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

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: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 3 voices.

Last updated by joeS-2 4 years, 4 months ago.

Assisted by: Jamal.

Author
Posts
#1821561
archivewordpress-archive.jpg

I am developing a wordpress archive that includes a search and filters to display a list of items that are related to a parent post type. I would like to include the title of the parent post type in my results. I don't see a shortcode for this, and I have not been able to find a related resolution in the support forum.

How can I return the name of the parent post for each of my results?

Toolset Types Version 3.4.2
Toolset Views Version 3.2.2.1

#1822173

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

With the legacy editor if you use the Fields and Views button to insert the post title the resulting dialog includes a post selection tab where you can specify something other than the current post as the source, including related posts from a Types relationship.

#1822869

Thanks Nigel. I was able to find this resulting dialog. The resulting shortcode is:
[wpv-post-title item="$parent"]
But unfortunately this shortcode doesn't return anything.

I have a relationship set up in "relationships" as "one to many" for the project cpt, and have connected a few of my publication posts to this one from within the publication.

So maybe I am missing something about how to set up the post relationship?

#1823261

I suspect that you did not choose the correct relationship in the popup window, that's why you get only "$parent" in the item attribute. The popup should return "@{relationship-slug}.parent".

Read more about the item attribute in this article https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

Let me know if you still need assistance with this.

#1826317

Got it. Thanks. I was able to get it working by choosing a different option. I think the wording of the options could be clearer, but I was eventually able to figure it out. Thanks!