2008-10-17 41 views
4

我不知道你需要多少信息,但WP-ContactForm-7是WordPress的聯繫表單。默認情況下,它對網站上的所有表單都有一個服務器響應消息。我有多種形式,並希望爲每個表單提供不同的服務器響應消息。WP-Contact Form 7 - PHP

如何爲每個使用此插件創建的不同表單創建不同的服務器響應消息?

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

如果這不是足夠的信息,那麼你可以從here下載文件,看整個源代碼。

+1

您可能想重新引用一些內容。不清楚這裏是否有問題,或者您是否共享解決方案以解決您遇到的問題。 – Randy 2008-10-17 02:09:54

+0

我同意rcar。 – Till 2008-10-20 21:10:05

回答

6

如果你確定你已經升級到這個插件的最新版本,你可以創建多個表單,每個表單都有自己的響應消息。

要創建一個新表單,請轉到工具 - >聯繫表單7,然後單擊「添加新的」(紅色的頂端)。

填寫新的表單詳細信息,然後轉到「信息」並點擊「顯示」。在這裏您可以填寫特定於此表單的回覆。完成後,再次向上滾動並單擊右側的「保存」按鈕。

然後,您可以通過使用類似包含一個鏈接到您的文章這個其他形式:

[接觸形式2「我的第二個形式」]

(將顯示使用的實際代碼在用於編輯表單的頁面上。)