WP-联系表格 7 -- PHP

发布于 2024-07-07 02:17:32 字数 1226 浏览 8 评论 0原文

我不知道您需要多少信息,但 WP-ContactForm-7 是 WordPress 的联系表单。 默认情况下,网站上的所有表单都有一条服务器响应消息。 我有多种表单,并且希望每个表单都有不同的服务器响应消息。

如何为使用此插件创建的每个不同表单创建不同的服务器响应消息?

以下是插件中的 PHP 代码片段,似乎与联系表单显示的消息相关:

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');
    }
}

如果这还不够,那么您可以从 此处 并查看整个源代码。

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

How can I create different server response messages for each different form that I create with this plugin?

Following is the snippet of PHP code from the plugin that seems to relate to the messages the contact form displays:

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 info then you can download the file from here and look at the whole source code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦毁影碎の 2024-07-14 02:17:32

如果您确保已升级到此插件的最新版本,则可以创建多个表单,每个表单都有自己的响应消息。

要创建新表单,请转到“工具”->“ 联系 Form 7,然后单击“添加新的”(顶部以红色显示)。

填写新表单详细信息,然后转到“消息”并点击“显示”。 您可以在此处填写此表格的特定回复。 完成后,再次向上滚动并单击右侧的“保存”按钮。

然后,您可以使用以下内容在帖子中包含指向此其他表单的链接:

[contact-form 2“我的第二个表单”]

(实际使用的代码将显示在用于编辑表单的页面上。)

If you make sure you've upgraded to the latest version of this plugin, you can create multiple forms, each with their own response messages.

To create a new form, go to Tools -> Contact Form 7 and click "Add new" (up the top in red).

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

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

[contact-form 2 "My second form"]

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文