Skip Navigation

[Resolved] relationships acting weird, pages are gone as well.

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

Problem: Parent / child relationships are behaving strangely and not working as intended

Solution: Disable Post Type Switcher plugin

Relevant Documentation: N/A

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

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Tagged: 

This topic contains 50 replies, has 2 voices.

Last updated by Christian Cox 7 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#492764

Trying to setup relationships. I use to refer to the pages below, but they are no longer available. Has this setup changed? Also, when I went through the one-to-many setup, it just didn't work. I followed the instructions to a tee and still nothing. It just keep display the name on the page it was on.

https://toolset.com/documentation/toolset-training-course/part-8-one-many-relationships/

https://toolset.com/documentation/toolset-training-course/part-9-many-many-relationships/

moi06

#492822

Hi there, we are in the process of updating the Toolset Training Course. Please bear with us while we make some updates to those pages. There's a notice up on the main page, but some of the course parts are unavailable:

https://toolset.com/documentation/toolset-training-course/

In the meantime, I would be happy to help you with your current problem. Can you give me some more details about what is happening so I can help you troubleshoot?

- What custom post types are you trying to create? Which custom post type is a parent, and which is a child? What posts have you created so far?
- Please clarify for me: "It just keep display the name on the page it was on." What does this mean? A screenshot can be very helpful to describe what is happening.

#492827

I have two Custom Post Types, Faculty & Staff. Faculty members has a Staff as a Support Admin. So I'd like to display that Staff member associated as that Faculty members Support Admin. So previously I saw that something like that could be done using a one-to-many relationship, but I just can't get that to work. I setup parent/child, then display this on this Admin Asst: [wpv-post-link id="ri-institute-staff"] but I just keep getting the name on the title the page is already on.

moi06

#492832

I see, thanks for the details. It sounds like this is what you want:

Faculty (Parent)
- Staff (Child)

Then when you go to the Faculty single page, you would like to show the name of the Staff associated with that Faculty member. Is this correct?

If so, the approach you are using will not work exactly right. This approach is used to display information about a parent post inside a loop that shows child posts. You want the opposite - you want to display information about a child post inside a parent post.

Here is some documentation about that:
https://toolset.com/documentation/user-guides/display-fields-table-content-using-views-or-the-types-api/

Basically you need to create a View that searches for Staff members, with a filter that displays Posts that are children of the Post where this View is inserted. In your Loop Output editor, make sure to include the post title or post link or something in each loop iteration. Then include the View you have just created on your Faculty page using a Content Template.

Does this make sense?

#492835

Hmm, ok, I'll give it a try. But I've already created views for both Faculty & Staff. So I need to create a totally new View to make this relationship work?

moi06

#492836

Also, that link you sent, it doesn't really explain how to add the relationship. That's the issue I've been having with Toolset, the documentation isn't great. It just just create the connection using the filter. Ok, we are missing something, now how do I display the connect.

moi06

#492838

I see, it sounds like I jumped ahead a bit too far. Views do not establish a relationship between a parent and child post types. Views is only used to show posts, not to provide relationship information. That's what Toolset Types is for. Types is used to establish relationships between custom post types. Here is a bit more information about that process:

https://toolset.com/documentation/user-guides/create-a-custom-post-type/

So when you create your custom post types "Faculty" and "Staff", you will assign a relationship between those custom post types. Please let me know if I have misunderstood what you are trying to accomplish, and I'll be glad to help.

By the way, there is a great deal of additional information in the User Guides:
https://toolset.com/documentation/user-guides/

#492841

Ok, I'll give it a try. Stay tuned...

moi06

#492845

The other thing is I'm trying to display the relationship using the Content Template, but again, not working very well. My site is locked based on IP address, so you can't see what I'm doing. So once I set this up, what's the proper tag to use to display Staff on the Faculty page? I guess it's not this - [wpv-post-link id="staff"]

moi06

#492847

And other thing, you said View do not establish the relationship, but Views has the filter needed to create the relationship. So if not Views, then where do I create the filter?

moi06

#492850
Screen Shot 2017-02-22 at 4.50.04 PM.png

And other thing, you said View do not establish the relationship, but Views has the filter needed to create the relationship.

I believe there was a miscommunication. I said that a relationship is created in Types when you define your custom post types. I said that Views..
...do not provide relationship information

You have referred to a relationship as something that can be displayed:
"I'm trying to display the relationship."

That is not accurate, and I would like to help explain that concept more clearly. You do not display a relationship, you display post information. Posts can be associated with one another using Parent / Child relationships. I hope this explanation helps you understand how post relationships work.

In your case, the Faculty post type will be specified as the parent of Staff post types. Here is a screenshot that shows where you define parent / child relationships in Types, not Views. You can see this screen if you go to Toolset > Post Types and click one of your Post Types.

#492854

I'll create a demo site on discover-wp, maybe we can connect there. I'll send more info once I set it up.

#492862

Ok, so I have created the demo setup with some content. see link below. I have also created the parent/child connection. I'd like to add the Staff name to the Faculty pages as a link. How would I do that? Let me know if I need to give you access to this demo site.

hidden link

moi06

#492874

Yes please provide login credentials for me. I will enable a private reply so your information is not public.

#493201

Hi, here's the process:

1. Edit your Staff View. In the section called Query Filter, Add a new filter. Filter by Post relationship - post is a child of. When your filter is inserted, choose the option "Post where this View is shown". Modify the "Loop item in Staff View" template to show the Staff member link only. Save.
2. Edit your Single Faculty content template. In the Template area, click the Fields and Views button. Insert your Staff View. Save.
3. Go to a Faculty page to see the Staff member added to your content.

Step 1 - in this step, we loop over all Staff members associated with the current Faculty member. In your case, the loop only displays 1 Staff.
Step 2 - in this step, we insert the View we created in step 1 into the Faculty Content Template. This way, every Faculty page will include the Staff View from step 1.

Please let me know if I can help explain these better.

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