Saltar navegación

[Resuelto] relationship form in a custom template

This support ticket is created hace 6 años, 3 meses. 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)

Etiquetado: 

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por Luo Yang hace 6 años, 3 meses.

Asistido por: Luo Yang.

Autor
Mensajes
#1100790

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

#1101354

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.

#1101753
Bildschirmfoto 2018-09-06 um 20.04.42.png

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

#1102273

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

#1104258

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