Skip Navigation

[Resolved] I would like to add a form on every CPT…

This support ticket is created 3 years, 3 months ago. 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.

This topic contains 2 replies, has 2 voices.

Last updated by steffK 3 years, 3 months ago.

Author
Posts
#2132551

Tell us what you are trying to do?
I would like to add a form on every CPT, front-end. The owner of that post type will receive the message to their email.

1. How can I create this form?

2. How do I add it to the post?

3. How do I make sure the owner of the post receives the mail?

Thank you

#2132625

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2021-08-03 at 16.05.58.png

You want to use the form for someone to contact the publisher of the post, yes?

With Toolset Forms, the forms always publish (or edit) a post, there are no disposable form submissions, so the first thing you need to do is create a CPT for the form submissions (e.g. "messages").

Then create a form to publish the messages, as described here: https://toolset.com/course-lesson/front-end-forms-for-adding-content/

In the settings for this form you will include a notification email, as described here: https://toolset.com/course-lesson/send-notifications-when-someone-submits-the-form/

In your case you need the form to be sent to the author of the post where you are going to display the form, and that needs handling in a particular way.

You need to add a Hidden generic field to your form (drag into the form from the section on the right), choose a slug for the field (e.g. "post-author"), and provide the following default value:

[wpv-post-author format="meta" meta="ID"]

Also, make sure the setting that this field is a user ID is checked (see screenshot).

Then when you add a notification, the email address for the recipient can be chosen under the setting "Send notification to a WordPress user with an ID coming from a generic field in the form".

You will then want to add your form to a template for the CPT in question (if you haven't already, make a new template at Toolset > Content Templates). See https://toolset.com/course-lesson/creating-templates-to-display-custom-posts/

#2134017

My issue is resolved now. Thank you!