Skip Navigation

[Resolved] Can CRED be used to set up many to many Relationships?

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

Problem: Can I use CRED; to create Posts in a Many to Many Relation, as I can in the WordPress Backend?

Solution: This is not possible in CRED.

There is a similar approach:

1. Create a CRED form that creates Parent Posts of type A https://toolset.com/documentation/user-guides/creating-cred-forms/

2. Create a CRED Form that creates Intermediary Child Post types

3. This CRED form should hold the Parent Post-Selector for the "other" parent Post Type (Type B) Also, you will insert the Parent Post-Selector for Type A, but hide it in a "

"

4. Insert this Form to a page

5. In the Parent Posts Content Template (or post body) for the Post which the Parent Post CRED Form for Type A form creates, insert a "Child Post CRED Link" and link it to the above page (The GUI will guide you through the steps) https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

6. Choose to set the parent according to this Post when inserting the CRED Link

7. Now see your Parent Post Type A and click on the create child post link

8. This will automatically set Parent Post type A, and you can then choose parent Post Type B in the Form

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.

This topic contains 2 replies, has 2 voices.

Last updated by Tim 5 years, 6 months ago.

Assigned support staff: Beda.

Author
Posts
#402379

Tim

I am trying to: create a CRED form to add a post that has a many to many relationship.

Can I create that record AND add the intermediate post type on the form (similar to the back end form)

eg. hidden link

#402493

In the WordPress backend, you can create a Parent Post, save it, and then from within the Child Posts table, add the Intermediary Child Post and choose it's parent as well (if a parent exists already)

Above process is not possible in CRED.

What you can do, is follow this approach:

1. Create a CRED form that creates Parent Posts of type A
https://toolset.com/documentation/user-guides/creating-cred-forms/

2. Create a CRED Form that creates Intermediary Child Post types

3. This CRED form should hold the Parent Post-Selector for the "other" parent Post Type (Type B)
Also, you will insert the Parent Post-Selector for Type A, but hide it in a "<div hidden>"

4. Insert this Form to a page

5. In the Parent Posts Content Template (or post body) for the Post which the Parent Post CRED Form for Type A form creates, insert a "Child Post CRED Link" and link it to the above page (The GUI will guide you through the steps)
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/

6. Choose to set the parent according to this Post when inserting the CRED Link

7. Now see your Parent Post Type A and click on the create child post link

8. This will automatically set Parent Post type A, and you can then choose parent Post Type B in the Form

#402598

Tim

Thank you for the straightforward answer and well explained example to work with.

Cheers, Tim