Skip Navigation

[Resolved] Retrieving the parent post-id in a child view

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

Problem:
How can I show Fields of a Parent Post, when I list Child Posts in a View?

Solution:
You can use different Parent ID attrubutes in Views ShortCodes.
As example, below will display the Title of the Parent Post:

[wpv-post-tile id="$parent_post_type"]

You have to replace "parent_post_type" with the real slug of your parent Post Type.

Relevant Documentation:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

This support ticket is created 7 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 1 voice.

Last updated by mohamed-saadC 7 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#395536

I am trying to: construct a portfolio gallery with Thickbox. I have a custom post type "screen captures" that is a child to a custom post type that is "websites". I need to retrieve the post-id of the parent post in the view I'm constructing for the childs posts. Is there a way to do that in views?

I visited this URL: https://toolset.com/forums/topic/retrieve-parent-info-within-a-function/

Is there a way to retrieve parent infos in a view for childs custom post types with views like parent's post-id, parent's title...?

#395866

Ok, sorry, I found the answer in the documentation. I'm posting it here in case, it helps anyone, we can simply retrieve the post id of the parent with the following shortcode:

[wpv-post-id id="$websites"]

where "websites" is the slug of the parent post type.

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