iDeasilo

Contact Form 7 1.10

Contact Form 7 1.10 is now available. New features in this version include additional mail headers, response message placeholder tags [response], the calling of user-specified JavaScript code when a message is sent successfully, controlling JavaScript loading with new constant, and much more. Therefore, I would highly recommend that you upgrade today!

Download | Plugin Homepage | FAQ | Support Forum

(日本語のドキュメントは下のほうにあります。)

Additional Mail Header

In the past, Contact Form 7 allowed you to set mail headers of To, From and Subject. Have you ever thought of adding Cc or Bcc headers to your mail? The newly introduced Additional Headers fields in the Mail and Mail (2) section are just for that purpose.

You can input any header lines into the field; and you can insert any tags into any place in each header line, just like other Mail fields.

[response] Tag

After a reader of your blog submits the contact form, he or she sees a response message from Contact Form 7, such as “Your message was sent successfully” or “Validation errors occurred.” I sometimes hear from users who tell me that the position of the response message is not good, and, in fact, sometimes their visitors miss the message entirely.

In the past, the response message was shown at the bottom of the form. I changed this by allowing users to locate their response massage placeholder as they like. The response message is shown within the placeholder after submission.

A tag [response] for the placeholder has been introduced. You can insert this [response] tag into any place of your choice in your form. You can use it multiple times in a form. If there is no [response] used, the response message is shown at the bottom of the form by default.

JavaScript Action Hook: on_sent_ok

Sometimes you might think of running custom codes after the form has been submitted. For example, you may wish to run Google Analytics’s tracking code for tracking their visitor’s usage of the contact form and counting it as conversions.

The new JavaScript action hook would be useful in such a case. If you have a JavaScript code you wish to run after form submission is completed successfully, simply insert the code into the Additional Settings section (which is new in this version and is placed at the bottom of the admin panel) with preceding on_sent_ok keyword, like this:

Note that you need to quote the codes properly; and the code must be in one line.

To show you a more practical example, if you want to insert Google Analytics’s tracking function, enter it like this:

on_sent_ok: "pageTracker._trackPageview('/funnel_G1/step1.html');"

Controlling JavaScript Loading with WPCF7_LOAD_JS Constant

By default, Contact Form 7 loads three JavaScript files — contact-form-7.js, jquery.form.js and jquery.js — into each page. They are necessary for Ajax. I believe that the smooth form submission with Ajax is one of the better points of Contact Form 7; however, I’ve heard from users they don’t like this feature and think the loading of these JavaScripts is wasteful. So I have made it controllable.

When the value of WPCF7_LOAD_JS is set to false (default: true), Contact Form 7 does not load the JavaScript. You can set the value of this constant in your wp-config.php like this:

define ('WPCF7_LOAD_JS', false );

Tip: If you set WPCF7_LOAD_JS as false, but you wish to load the JavaScripts only on specific pages, call wpcf7_enqueue_scripts() in your template file. Note that wpcf7_enqueue_scripts() must be called before wp_head() is called.

Other Changes

Translation Updates

New addition:

Updated:

Thank you.


(in Japanese from here)


Contact Form 7 1.10 をリリースしました。追加メールヘッダー、応答メッセージのプレースホルダーとしての [response] タグ、メッセージ送信に成功した時の JavaScript 呼び出し、定数での JavaScript ロードの抑制、などなど、たくさんの機能をこのバージョンでは導入しています。この機会にアップグレードをおすすめします。

追加メールヘッダー

従来の Contact Form 7 では To (宛先)、From (送信元)、Subject (件名) のメールヘッダを指定できました。これに CcBcc のヘッダーを追加したいと思ったことはありませんか? メールメール(2)両セクションに新しく導入した追加ヘッダー項目はまさにこのためのものです。

このフィールドに任意のメールヘッダー行を入力してください。それから、メールセクションのほかの項目と同様に、好きな場所にタグを挿入できます。

[response] タグ

ブログの訪問者がコンタクトフォームで送信すると、その訪問者は Contact Form 7 の応答メッセージを見ますよね。「あなたのメッセージを送信しました」とか「入力内容に不備があります」とか、そういうのです。よくユーザーから言われていたのですが、この応答メッセージを表示する場所がよくないので、訪問者がたびたびこのメッセージを見落としてしまうのだそうです。

従来のバージョンではこの応答メッセージをフォームの一番下に表示するようにしていたのですが、今回これを変更して、ユーザーが自由な位置に応答メッセージのプレースホルダーを置けるようにしました。応答メッセージは送信後にこのプレースホルダーの中に表示されるようになります。

このプレースホルダーを表現するタグとして、[response] を新たに導入しました。これをフォームセクションの中でならどこでも、何回でも挿入できます。もし [response] が1回も使われていなかったら、従来どおりフォームの一番下に応答メッセージを表示します。

JavaScript アクションフック: on_sent_ok

フォームの送信が完了した時に何かコードを実行したい、と思うこともあるかもしれません。例えば、Google Analytics のトラッキングコードを走らせて、訪問者のフォーム利用を追跡したり、それをコンバージョンとしてカウントしたりとか。

新しく導入した JavaScript アクションフックはそんなときに便利です。フォームの送信に成功した時に実行させたいコードがあったら、その先頭に on_sent_ok のキーワードをつけて、「その他の設定」セクション(これもこのバージョンで新規導入されたもので、管理パネルの一番下にあります)に挿入するだけです。こんな感じ:

コードを適切な引用符で囲む必要があるので気をつけてください。それからコードは1行に収まっていないといけません。

もっと実用的な例として、Google Analytics のトラッキング関数を使うならこんな感じになります:

on_sent_ok: "pageTracker._trackPageview('/funnel_G1/step1.html');"

WPCF7_LOAD_JS 定数による JavaScript ロードの抑制

デフォルトでは Contact Form 7 は contact-form-7.js、jquery.form.js、jquery.js の3個の JavaScript ファイルを個々のページでロードします。これは Ajax の機能に必要です。Ajax を使った滑らかな送信動作というのは Contact Form 7 の良いところのひとつだと自負していますが、聞くところによるとこの機能が好きではなく、このために JavaScript ファイルを読み込むのも無駄でしかないと考えている(いけすかない!)ユーザーもいるようです。仕方がないので、この機能をオン・オフ変更できるように変えました。

WPCF7_LOAD_JS 定数の値が false の場合(デフォルトでは true)、Contact Form 7 は JavaScript をロードしません。定数を設定するなら wp-config.php の中でこんな風にするといいでしょう:

define ( 'WPCF7_LOAD_JS', false );

裏技: WPCF7_LOAD_JSfalse に設定したものの、特定のページでは JavaScript を読み込ませたいという場合は wpcf7_enqueue_scripts() をテンプレートファイルの中で呼び出してください。wpcf7_enqueue_scripts()wp_head() より先に実行される必要があるので注意してください。

その他の変更

翻訳の更新

新規追加:

更新:

ありがとうございました。