Skip Navigation

[Resolved] Create a front-end form for CPT with relationsship to another CPT

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

Author
Posts
#1830665

Tell us what you are trying to do?

Assume you have two CPTs ("company" and "employee"). They are connected with a one to many-relationsship (a number of "employees" are working at exactly one "company"). The "company"-posts exist already - and now I want to maintain the "employees" in the front-end.

I want to do this:

1) within a Toolset archive list of "companies", I want to have a link for each "company" displayed, to create a new employee (using an employee form) - and automatically assign the relationsship from the new "employee" to the "company". This should be one step - not first create employee and then second create the relationship.

2) within a Toolset archive list of "companies", I want to have a link for each "company" to display a list of employees assigned to the "company"

3) for each of the "employees" in the displayed list (under no 2) I want a link to modify/change the content of the "employee" post.

4) for each of the "employees" in the displayed list (under no 2) I want a link to delete the content of the "employee" post. This should also delete the relationsship between the existing "company" and the deleted "employee".

I cannot find any toolset documentation/YouTube videos on how to work with forms for CPTs in relationships to achieve above four features.

I hope you understand my explanation and looking forward hearing from you 🙂

BR BO

#1831679

Hello,

Q1) Please follow our document to setup the child post form for creating new "employee" post:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

Q2) Yes, within single "company" post, you can display it's related child "employee" posts, please check our document:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

Q3) You can follow our document to setup the edit "employee" post form and edit link:
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

Q4) You can follow our document to setup the delete post link:
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred-delete-post

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