Skip Navigation

[Waiting for user confirmation] Add a link to a relationship 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 5 replies, has 1 voice.

Last updated by Minesh 1 day, 12 hours ago.

Assisted by: Minesh.

Author
Posts
#2816047

Hi.

I have 2 CPT's related. "Movies" and "Crew Member"

I created a relationship (1toMany) form between both to add crew member Childs to the parent movies.

On the single page of a movie I want have a link to the relationship form to "preselect" the parent (the movie).

So I add a "Fields and Views" and select my relationship link. But the results is only "tiny_mce_marker" instead of the link to the form. What did I do wrong ?

#2816152

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please make sure that you followed the steps given with the following Doc:
- https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

#2816522

Hi Minesh.

I've made a mistake, so this reminder helps.
However, I'd like on my "movie" page have a link "add a crew member" which will open the form page with the preselected "movie" from where I come. Can you help ? Because for the moment, the "movie" selected is the current post which is the form page...

#2816531

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Minesh is not available today. We are sorry for the inconvenience and appreciate your patience, He will be available soon to check with your question.

To answer your question would you please follow the steps below?

1  Put the form on its own page

Create a page called “Add crew member” (or use an existing one) and add the relationship‑form shortcode, telling it which movie should be pre‑selected:

[cred_form
  form="add-crew-member"             ; slug or ID of your relationship form
  parent_id="[wpv-search-term param='movie_id']"
]

* parent_id is the attribute that sets the parent post for one‑to‑many relationships.
* [wpv-search-term] pulls whatever you pass in the URL (movie_id=123).

2  Place a link on every single‑movie page

Inside the template for Movies add an ordinary link or button:

<a href="/add-crew-member/?movie_id=[wpv-post-id]">
     Add a crew member
</a>

[wpv-post-id] outputs the ID of the movie you’re viewing, so the link becomes something like:

/add-crew-member/?movie_id=456

Thanks.

#2816534

Hi Christopher.

Thanks a lot for your help. What is the syntax if I want to replace the "form="add-crew-member" " by the ID of the form ? Because with the slug targeting it does not find the form. Its a many to many relationship. Maybe it's where the issue is...

#2816674

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - with your initial post:
- https://toolset.com/forums/topic/add-a-link-to-a-relationship-form/#post-2816047

You described that you have one-to-many post relationship:

have 2 CPT's related. "Movies" and "Crew Member"

I created a relationship (1toMany) form between both to add crew member Childs to the parent movies.

Now, you say you have many to many post realationship.

For many to many post relationship, you will have to use the relationship form.
- https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/