Skip Navigation

[Resolved] display parent of post in a separate view

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#597711
example post parent relationships.png

Tell us what you are trying to do?

I have a page displaying a post (News) which is a child of a parent post type (Partner). i.e Partners create News items.

I want to display a short profile of the partner who created the News post in a view in the page sidebar. I know how to display fields from Parents within a view/content template displaying the child.

I have struggled for hours through various documentation to display the Parent in a separate view.

Is there any documentation that you are following?

Various - including passing arguments to views where I try to pass the correct Parent id.

Is there a similar example that we can see?

hidden link which shows the correct Partner name at the bottom of the main view; but the wrong partner view in the two versions of my test Views below and in the sidebar.

What is the link to your site? hidden link

I'm spending way too much time on this - it's probably very simple but I've gotten bogged down in detail! Thanks for your help.

#597796

Hi, here's how I would approach this:
- In your Partner View, make sure you have a Query Filter set up to filter by Post ID, where the id comes from a shortcode attribute "ids"
- That will allow you to place the Partner View anywhere and pass in a Partner ID like this:

[wpv-view name="your-partner-view-slug" ids="123"]

- In this case "123" is the Partner ID we want to display. In your case, however, the Partner ID must be variable because I assume you want this View to work on all the different News pages. So you must use another shortcode to get the ID of the current post's parent Partner:

[wpv-post-id id='$partner']

- This assumes the Partner post type slug is "partner", so if yours is something else you must change it here to match.
- Combine these two shortcodes to create a dynamic View that will show information about the current post's parent Partner:

[wpv-view name="your-partner-view-slug" ids="[wpv-post-id id='$partner']"]

The forum ‘Types Community Support’ is closed to new topics and replies.