WP-Contact Form 7 - PHP

I don’t know how much information you need for this, but WP-ContactForm-7 is the contact form for WordPress. By default, it has one server response message for all forms on the website. I have several forms and would like to have different server response messages for each of them.

How to create different server response messages for every other form that I create with this plugin?

The following is a snippet of the PHP code from the plugin, which seems to apply to messages displayed by the contact form:

function message($status) { switch ($status) { case 'mail_sent_ok': return __('Your message was sent successfully. Thanks.', 'wpcf7'); case 'mail_sent_ng': return __('Failed to send your message. Please try later or contact administrator by other way.', 'wpcf7'); case 'validation_error': return __('Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7'); case 'accept_terms': return __('Please accept the terms to proceed.', 'wpcf7'); case 'invalid_email': return __('Email address seems invalid.', 'wpcf7'); case 'invalid_required': return __('Please fill the required field.', 'wpcf7'); case 'captcha_not_match': return __('Your entered code is incorrect.', 'wpcf7'); } } 

If this is not enough, then you can download the file here and see the entire source code.

+4
source share
1 answer

If you are sure to update to the latest version of this plugin, you can create several forms, each with its own response messages.

To create a new form, open "Tools" - "Contact Form 7" and click "Add New" (top red).

Fill out your new form details, then go to "Messages" and click "show." Here you can fill out the answers specific to this form. Once you're done, scroll to the top and click the "Save" button on the right.

You can then add a link to this other form in your posts using something like:

[contact form 2 "My second form"]

(The actual code to use will be displayed on the page used to edit the form.)

+6
source

All Articles