Skip Navigation

[Resolved] How to add relationships on post form

This support ticket is created 4 years 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#1578021

Tell us what you are trying to do?

How can I add pull-down selections for relationships?

I have 2 custom post types "State" and "County" each County post belong to a "state." I already set up the relationship.
I already imported states and counties into corresponding post types. If you go my top page, you can choose a state(california) and counties(Alamenda...etc) come up afterword.

But I cannot do the same thing on post form.
hidden link

Please help me.

#1578383

Hello,

I have checked the URL you mentioned above, I don't find "state(california) and counties", please check it:
hidden link

I assume we are talking about these:
1) Three post types:
- State
- County
- Posts

2) Two post type relationships:
- One-to-many relationship between "State" and "County"
- One-to-many relationship between "County" and "Posts"

You are going to create a post form for creating posts, with two dropdown menu fields:
- State
- County

If it is, there isn't such kind of built-in feature, you can setup only one direct parent field "County" in the post form.

So you might try this workaround:
Create a page with nested post view:
- Query "County" posts
- Filter by relationship between "State" and "County"
- In view's loop, display child form link for creating "post"

#1578839

Thank you for your support.
I still don't understand what to do.

I added dropdown menus on (1) hidden link
But I still don't know how to connect with State and County post types times inside of the dropdown.
So when a user choose "California" from state, only counties in California shows up and choose.

As I stated previously. I have already achieved this on search and view on front end. here
You see example here(2) hidden link

I just want to do the same thing when the user create a post which is (1)

Please explain a little more in detail about how to achieve this.

#1579397
child-post-link.JPG

I have checked the URL you mentioned above it is 404 error, please check it.

Here are details steps:
1) Create a post form for creating new "Posts", for example: "New post form"
2) Create a page "Create post page", display above post form "New post form"
3) Create a post view:
- Query "County" posts
- Filter by relationship between "State" and "County"
- In the content template of view's loop, display child form link for creating "post":
Make sure you are using classic editor, click button "Toolset Forms", click "Create Child Post Link", choose "Create post page"(step 2), see screenshot child-post-link.JPG
4) Put the post view into a wordpress page, and test it in front-end.

So user can search by "state" and find specific "County" post, and click the link to create related posts

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