Tell us what you are trying to do?
I have 3 custom post types cpt1, cpt2, cpt3. I have a custom field called cf which I assigned to all of the custom post types. I have created a form to get the custom field data and assigned it to cpt1. Now I want to assign the same form to cpt2 and cpt3. How can I do that?
Hi there,
The post forms in Toolset are for each post type.
So for your scenario, you need to create a post form called C1 Add and another form C1 Edit to add and edit C1 post types.
For the C2 you need to add a C2 post for for edit and C2 post form for Adding. And the same for the C3.
On all three forms you will add the CF as an input in the form.
If the C1 form is submitted, the CF inside the c1 will get a value. If C2 is submitted the Cnside C2 will get a value nd so on...
For more information:
https://toolset.com/course-lesson/front-end-forms-for-adding-content/
Thanks.
I want to use the same form to all of the custom post types. That is my problem. Is there any solution?
Hi there,
Unfortunately, it is not possible to do so. The problem from the Toolset point of view is that if you have one form, Toolset does not know which custom post type the form is about to add the custom field there.
Would you please give me the scenario that you have to have three different custom posts ut one form? I might be able to find an alternative solution to avoid such a thing.
Thanks.
Yes, I have 3 different custom post types which have the same custom field group. I have a post edit form that will take input of a custom field of the custom field group. I have a elementor template to show all of the 3 post types and I added the post edit form in the template. Now the form is visible on the frontend for only one post type that I assigned. The other 2 post types aren't showing the form in the frontend rather showing 'Form type and post type do not match'. Kindly help.
Hi there,
Ok there is no escape for the forms. You need to create three forms for the three post types.
You will get a shortcode for each form.
Now inside the Elementor template you can use this shortcode:
[wpv-conditional if="( '[wpv-post-type]' eq 'custom-post-slug-1' )"]
shortcode for the form for custom-post-slug-1
[/wpv-conditional]
Replace "custom-post-slug-1" with the slug of your custom post 1.
Inside the shortcode, instead of:
shortcode for the form for custom-post-slug-1
Add the shortcode for the form that you have created for the custom post 1.
Duplicate the same code for the other two post types. Now system will detect which post type is in question and the form for that post type will show.
I used this shortcode:
[wpv-conditional if="( '[wpv-post-type]' eq 'saas' )"]
[cred_form form='form-for-saases']
[/wpv-conditional]
But it isn't working. Can you kindly check?
I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.
Make sure you set the next reply as private.
Also give me the URLs of the Elementor Template so I can check the code.
Thanks
Hi there,
I found a solution doing the steps below:
- Go to Toolset > Content Templates
- Add a new Content Template and do not assign it anywhere. (I named it conditional-logic)
- Use the Conditional Block and The forms block to create the condition you want.
- Check the attached screenshot to see how I added the logic.
- In the Elementor layout added an HTML element and used the code below:
[wpv-post-body view_template="conditional-logic"]
- This code retrieves the content template in question.
Now please go to the content template and add other conditionals for the other post types and it should work.
At the end you always should see one form out of three forms you have created.
Thanks.
Thanks for the assistance. The method is working.
While editing the elementor template the word 'Rating' is appearing two times. Though it doesn't appear on the front end. Even when I add a shortcode of form in the shortcode element in elementor, the word 'Rating' appears two times.
Is there any way to remove the extra 'Rating' word?
Hi there,
I checked and not sure why that happens. But as this is not affecting the front end of the website you can ignore it.
Thanks.
My issue is resolved now. Thank you!