There are many great code snippets in their Gitlab. You might find more on their…
Toolset – Relationship Forms – Preselect Parent In a Form Link
I struggled a lot but finally found out how create a [cred-relationship-form-link] that links to an unspecified (not attached to any post type) content template that contains a relationship form.
Create the necessary content types
At first you need to create the content type you want to be a child of another prior created content type. Of course you also need a parent, whether it be an existing or another newsly created one.
Create the relationship (one to many)
Then you need to create a „one to many realtionship“ connecting your new child post type (one) to „many“ parent post types.
Create a post form for creating a new child post
Afterwards you need to create a post form to create a post of the new child post type. And here is the deal:
When reating the child post form you can insert a field that creates a select box to select the parent post. Here you simply need to add a value that preselects the parent: value='[wpv-post-id id="$current_page"]'
[cred_field field='@an-pattern-review.parent' class='form-control' output='bootstrap' select_text='--- nicht eingestellt ---' value='[wpv-post-id id="$current_page"]']
Create a content template that contains the post form for your child posts
Then you have to create an unspecified content template that contains the shortcode to the (CRED) form to create the new child post type.
Add the Link to create a child post to the view that loops the parents
After this you simply need to edit the view where you want to place the link that opens the content template with the child post creation form where the parent from the view loop is preselected.
[cred-relationship-form-link form=’add-a-review-to-a-an-pattern‘ parent_item=’$current‘ content_template_slug=’mentoring_template‘]Eine andere Review verbinden[/cred-relationship-form-link]I have found the solution in the toolset forums: https://toolset.com/forums/topic/set-automatically-parent-child-relationship-in-reviewing-system/
Dieser Beitrag hat 0 Kommentare