Hey there!
Tell us what you are trying to do?
I want to built this:
1. Custom Post type called "Events" (Parent)
2. Built a Single Template for "Events"
3. In the Single Template for "Events" i want to display another form for a second Custom Post Type called "Gallery" (Child)
4. When the form for the second Post Type "Gallery" is sent it should automatically have a relationship to the Parent "Event" in a One (Event) to Many (Gallery) Relationship.
in short words: bind the Child to the Parent on which the form is displayed and send.
So Step 1-4 is not really a problem but having the relationship going is not really clear for me.
Thanks for your help.
Cheers
Hello,
I think it is possible within Toolset, you can setup one-to-many relationship between post types "Events" and "Gallery"
https://toolset.com/documentation/post-relationships/
setup a content template for single "Events" post:
https://toolset.com/documentation/user-guides/view-templates/
In the content template, display a Toolset form for creating the child "Gallery" post:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
And it can automatically have a relationship to the Parent "Event" in a One (Event) to Many (Gallery) Relationship
See section "Creating forms when a parent post is preselected" of above document, you just need to use some CSS codes to hide the parent selector.
hey Luo,
thanks for your help. this is exactly what i want.
i did it like in the manual.
But the relationship field is not preselected to the parent (screenshot)
Any Ideas?
cheers
Please provide a test site with the same problem, also point out the problem page URL and form URL, I need to test and debug it in a live website. thanks
Thanks for the details, I have done below modification in your website:
Edit the Form "Gallery Form", in section "Inhalt", change the codes from:
[cred_field field="@event-gallery.parent" class="form-control" output="bootstrap" select_text="--- nicht eingestellt ---"]
To:
[cred_field field="@event-gallery.parent" class="form-control" output="bootstrap" select_text="--- nicht eingestellt ---" value="[wpv-post-id id="$current"]"]
It will be able to set current event post ID as the default value
More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
value. Optional. Preset value