Skip Navigation

[Closed] Instructions for using relationships

This support ticket is created 3 years, 7 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.

Our next available supporter will start replying to tickets in about 8.11 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 3 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2028787

I'm having a hard time figuring out relationships and I can't seem to find the right help on your site.

I'm hoping you can point me to some resources.

I am building a database tool with three custom post types, each with their own set of custom fields:

1) The main (maybe parent?) post type, which contains user information (name, age, address, etc.)

2) A sub-post type that will contain a list of service records for each user (service type, date)

3) Another sub-post type that contains a list of people related to the user in the main post type

When a record (post) from the main post type is displayed, I want it to display the two sub-post types associated with it. I can't figure out how to do this.

Thanks in advance for any assistance.

#2028879

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-04-21 at 1.44.52 PM.png

Hi John,

Thank you for getting in touch.

Based on your description I suspect that you want a setup like this below.

- Parent Post A
--Child Post A
-----Grand Child Post A

All of this information being displayed on Parent Post A page. If so then this is going to require at least 1 nested view. The First step is that you need to create the grand child view.

On this grand child view you will add a query for the Post Relationship. If you're not seeing the query filter section you must scroll to the top of your page and on the top right hand corner you will see Screen Options click this and enable the Query Filters. Now scroll to the Query Filter section and Add a Filter for the Post Relationship, then select the relationship from the dropdown and set the filter to " The current post in the loop". See Screenshot

Now that we have the Grand Child view created, you're going to repeat the above steps to create the Child view, however instead of setting the Child view's Post Relationship filter to " The current post in the loop" you will set it to "The post where this View is shown".

The next step is to nest the grand child view into the Child view, this can be done by using the Fields and Views button in the Loop Editor section of your view and select your child view and add it. Ensure that the child view's shortcode is added within the <wpv-loop> tags.

Finally you will add the child view itself to the template of your Parent post. Once this is done correctly you should see the correct relational information being displayed according to the Parent view.

Please let me know if this helps or if you're having trouble with any of these steps.
Thanks,
Shane

The topic ‘[Closed] Instructions for using relationships’ is closed to new replies.