前言介紹
- 這款 WordPress 外掛「Contact Form 7 – Dynamic Text Extension」是 2010-10-10 上架。
- 目前有 100000 個安裝啟用數。
- 上一次更新是 2025-03-03,距離現在已有 60 天。
- 外掛最低要求 WordPress 5.5 以上版本才可以安裝。
- 外掛要求網站主機運作至少需要 PHP 版本 7.4 以上。
- 有 99 人給過評分。
- 論壇上目前有 6 個提問,問題解答率 17%
外掛協作開發者
sevenspark | tessawatkinsllc |
外掛標籤
autofill | form field | prepopulate | dynamic form | contact form 7 |
內容簡介
Contact Form 7 是一個出色的 WordPress 外掛,也是免費 WordPress 聯絡表單外掛的首選之一。 Contact Form 7 - Dynamic Text Extension (DTX) 通過添加動態內容功能,使其更加強大。雖然 Contact Form 7 中的預設值是靜態的,但 DTX 可以讓您根據其他值創建預填充字段。一些示例可能包括:
- 自動填充 URL
- 自動填充文章 ID、標題或縮略名
- 預先填充產品編號
- 引用網站上的其他內容
- 使用文章信息填充
- 使用用戶信息填充
- 使用自定義字段填充
- 為支持票證生成唯一標識符
- 任何使用自定義短碼的值
可能性是無限的!
DTX 隨附數個內置短碼,可使聯絡表單從 HTTPS GET 變量或 get_bloginfo() 函数中的任何信息填充,及其他。請參閱以下所述的包含短碼。
在列表中未找到您需要的短碼?您可以編寫自定義短碼!任何返回字符串或數值的短碼都可在此使用。內置的短碼僅涵蓋最常見的情況,但 DTX 提供了靈活性,讓您以編程方式獲取任何值。
安裝並啟用插件後,在創建或編輯 Contact Form 7 表單時,您將有兩種新的標籤類型可供選擇:動態文本字段和動態隱藏字段。它們的標籤生成器中大多數選項都對 Contact Form 7 的用戶來說是熟悉的,但也有一些升級內容。
動態值
這些字段可以接受短碼,帶兩個重要之處:
- 短碼不應包含正常的方括號 ([ 和 ])
- 短碼中的任何參數必須使用單引號。即:CF7_GET key='value',而不是 CF7_GET key="value"
動態佔位符
僅適用於動態文本表單標籤,此字段可以接受靜態文本或短碼。如果使用短碼,則從動態值字段適用相同的語法。然而,此字段還有一些需要:
- 將符號轉換為其 HTML 實體代碼,例如將撇號轉換為 '。
- 之後,必須將其 URL 編碼,以便空格變為 %20,而其他非字母數字字符則轉換為其他字符。
唯讀屬性
僅適用於動態文本表單標籤,如果不想讓用戶編輯此字段,只需選中此框即可。它將向您的表單字段添加 readonly 屬性。
插件中包含數個短碼,可立即與 Dynamic Text Extension 一起使用。您也可以自己編寫,任何自關短碼都可以使用,即使帶有屬性!
當前 URL 或當前 URL 部分
檢索當前 URL: CF7_URL
您的 Contact Form 7 標籤將如下所示:[dynamictext dynamicname "CF7_URL"]
可選參數:部分,將返回 URL 的分析部分。有效值為主機、查詢和路徑。
原文外掛簡介
Contact Form 7 is an excellent WordPress plugin and one of the top choices of free WordPress plugins for contact forms. Contact Form 7 – Dynamic Text Extension (DTX) makes it even more awesome by adding dynamic content capabilities. While default values in Contact Form 7 are static, DTX lets you create pre-populated fields pulled from other locations. Some examples might include:
Auto-filling a URL or just getting the domain name or path
Auto-filling a post ID, title, or slug
Auto-filling a title, URL, or slug for the current page
Pre-populating a product number
Referencing other content on the site
Populating with post or page info
Populating with the current user’s info
Populating with custom and meta fields
Generating unique identifiers for support tickets
Getting a list of post categories or other custom taxonomies
Getting a value from a cookie
Getting custom theme modifications
Any value using custom shortcodes
The possibilities are endless!
View Demo
For over 10 years, DTX only handled and form fields, but version 4 finally introduces more:
email
URL
tel (for phone numbers)
number
range (slider)
textarea (multiline text)
drop-down menu (select field)
checkboxes
radio buttons
date
submit (yes, a submit button where you can have dynamic text!)
WHAT DOES IT DO?
DTX provides flexibility to WordPress users in creating dynamic forms in Contact Form 7. DTX comes with several built-in shortcodes that will allow the contact form to be populated from HTTPS GET variable or any info from the get_bloginfo() function, among others. See below for included shortcodes.
Don’t see the shortcode you need on the list? You can write a custom one! Any shortcode that returns a string or numeric value can be used here. The included shortcodes just cover the most common scenarios, but DTX provides the flexibility for you to grab any value you have access to programmatically.
Dynamic Value
The bread and butter of this plugin, set a dynamic value! This field can take any shortcode, with two important provisions:
The shortcode should NOT include the normal square brackets ([ and ]). So, instead of [CF7_GET key='value'] you would use CF7_GET key='value'.
Any parameters in the shortcode must use single quotes. That is: CF7_GET key='value' and not CF7_GET key="value"
Dynamic Placeholder
Set a dynamic placeholder with this attribute! This feature accepts static text or a shortcode. If using a shortcode, the same syntax applies from the dynamic value field. However, this field also has a few more needs:
The text/shortcode must first have apostrophes converted to it’s HTML entity code, '
After that, it must be URL encoded so that spaces become %20 and other non-alphanumeric characters are converted.
If you’re using Contact Form 7’s tag generator to create the form tag, those extra needs are already taken care of. Dynamic placeholders are not available for dynamic hidden form tags.
Learn more and see examples from the DTX Knowledge base.
Compatible with Caching Plugins
DTX is cache friendly! You can set a field to be calculated after the page loads by setting the dtx_pageload attribute to any dynamic form tag.
Many websites use caching plugins to optimize for performance. If your website caches the HTML of the form, then any dynamic form fields you have get their first calculated value cached alongside it. This becomes an issue if you’re using DTX to pull values from a cookie or the current URL’s query string.
This is best for dynamic form fields that:
gets the current URL
gets a value from the URL query
gets a value from a cookie
gets the current user’s info
generates a unique identifier (GUID)
For dynamic fields that are page-specific, it’s perfectly safe to cache those values. For example, dynamic form fields that:
getting the page or post’s ID, title, or slug
getting post meta for the current page
getting the post’s assigned categories, tags, or other custom taxonomy
getting site info
getting theme modification values
Note: Enabling a dynamic field to be calculated after the page loads will add frontend JavaScript. Depending on the shortcode used as the dynamic value, an AJAX call to the server may be sent to be processed. The script is minified and loaded in the footer and is deferred, minimizing impact on site performance and the AJAX calls are called asynchronously to avoid being a render-blocking resource and minimizing main-thread work. The script itself can be safely cached too.
Learn more and see examples from the DTX Knowledge base.
Read Only Form Fields
Check this box if you do not want to let users edit this field. It will add the readonly attribute to the input form field. This feature is not available for dynamic hidden form tags.
Obfuscate Values for Enhanced Privacy
If you’re pre-filling a form field with an email address, bots can scrape that value from the page and use it for spam. You can add an additional layer of protecting by obfuscating the value, which turns each character into it’s ASCII code. To the human eye, it looks like the character it’s supposed to be because browsers will render the ASCII code, but for bots, it won’t look like an email address!
HOW TO USE IT
After installing and activating the plugin, you will have 2 new tag types to select from when creating or editing a Contact Form 7 form: the dynamic text field and dynamic hidden field. Most of the options in their tag generators will be familiar to Contact Form 7 users but there have been some upgrades.
How to Obfuscate Values
All of the shortcodes included with the DTX plugin allow the obfuscate attribute that you can set to any truthy value to provide an additional layer of security for sensitive data.
The Contact Form 7 tag with obfuscation turned on would look like this: [dynamictext user_email "CF7_get_current_user key='user_email' obfuscate='on'"]
How to Enable Cache-Friendly Mode
All of the dynamic form tags can be enabled for processing on the frontend of the website, or the client-side, by adding the dtx_pageload attribute to the Contact Form 7 form tag.
In the form editor of Contact Form 7, your form tag would look like: [dynamictext current_url dtx_pageload "CF7_URL"]
If using the tag generator, it’s as simple as checking a box!
INCLUDED SHORTCODES
The plugin includes several shortcodes for use with the Dynamic Text Extension right out of the box. You can write your own as well—any self-closing shortcode will work, even with attributes!
Current URL or Part
Retrieve the current URL: CF7_URL
In the form editor of Contact Form 7, your form tag would look like: [dynamictext dynamicname "CF7_URL"]
Optional parameter: part, which will return a parsed part of the URL. Valid values are host, query, and path
Host: Just the domain name and tld
[dynamictext host “CF7_URL part=’host'”]
Query: The query string after the ?, if one exists
[dynamictext query “CF7_URL part=’query'”]
Path: The URL path, for example, /contact, if one exists
[dynamictext path “CF7_URL part=’path'”]
Learn more and see examples from the DTX Knowledge base.
Referrer URL
Get the referral URL, if it exists. Note that this is not necessarily reliable as not all browsers send this data.
CF7 Tag: [dynamictext dynamicname "CF7_referrer"]
Learn more and see examples from the DTX Knowledge base.
Current Page Variables
Retrieve information about the current page that the contact form is displayed on. Works great for use in templated areas like the site header, footer, widget, or sidebar! The shortcode works as follows:
Built-in shortcode: CF7_get_current_var
Required attribute: key
Possible values for key include:
id
title
url (an alias for CF7_URL)
slug
featured_image
terms (an alias for CF7_get_taxonomy)
For pages that use a WP_POST object, this acts as an alias for CF7_get_post_var so those attributes work here as well.
For author pages, this acts as an alias for CF7_get_current_user so those attributes work here as well.
In the form editor of Contact Form 7, your form tag’s value could look like: CF7_get_current_var key='title'
And then the full form tag would be: [dynamictext dynamicname "CF7_get_current_var key='title'"]
Learn more and see examples from the DTX Knowledge base.
Post/Page Info
Retrieve information about the current post or page (must be for a WP_POST object) that the contact form is displayed on. The shortcode works as follows:
CF7_get_post_var key='title' Contact > Dynamic Text Extension > Meta Key Allow List. More Information
The dynamic value input becomes: CF7_get_custom_field key='my_custom_field'
And the tag looks like this: [dynamictext dynamicname "CF7_get_custom_field key='my_custom_field'"]
For the purposes of including an email address, you can obfuscate the custom field value by setting obfuscate=’on’ in the shortcode like this:
[dynamictext dynamicname “CF7_get_custom_field key=’my_custom_field’ obfuscate=’on'”]
Learn more and see examples from the DTX Knowledge base.
Featured Images & Media Attachments
Retrieve the current post’s featured image, the featured image of a different page, or any attachment from the Media Library with this shortcode!
The base shortcode is simply: CF7_get_attachment which returns the absolute URL of the current page’s featured image.
By setting the post_id attribute to a post ID, you can get the featured image of another page.
By setting the id attribute to an attachment ID, you can get the absolute URL of any image uploaded to your WordPress website.
By setting the size attribute to any size registered on your website, you can get a specific image size.
Want to return the attachment ID instead of the URL? Also not a problem! Just set return='id' in the shortcode.
Most of the optional attributes can be used at the same time. For example, if I wanted to retrieve the attachment ID of a featured image for a different post, then the dynamic text form tag would look like this:
[dynamictext input_name “CF7_get_attachment post_id=’123′ return=’id'”]
If I wanted to get a specific image at a specific size, I can use this:
[dynamictext input_name “CF7_get_attachment id=’123′ size=’thumbnail'”]
The only two attributes that can’t play together is id and post_id. If both are specified, it will get the attachment specified by id and completely ignore the post_id attribute. If neither are specified, then it looks to the current featured image assigned to the global $post object.
Learn more and see examples from the DTX Knowledge base.
Current User Info & User Meta
Get data about the current logged-in user.
Dynamic value: CF7_get_current_user key='user_displayname'
CF7 Tag: [dynamictext dynamicname "CF7_get_current_user"]
Note: You must add any user keys that you want to allow access to to the allow list in your admin panel > Contact > Dynamic Text Extension > User Data Key Allow List. More Information
Valid values for key include:
ID
user_login
display_name
user_email
user_firstname
user_lastname
user_description
But also custom meta user keys!
For the purposes of including an email address, you can obfuscate the value by setting obfuscate=’on’ in the shortcode like this:
[dynamictext dynamicname “CF7_get_current_user key=’user_email’ obfuscate=’on'”]
Learn more and see examples from the DTX Knowledge base.
Site/Blog Info
Want to grab some information from your blog like the URL or the site name? Use the CF7_bloginfo shortcode. For example, to get the site’s URL:
Enter the following into the “Dynamic Value” input: CF7_bloginfo show='url'
Your Content Form 7 Tag will look something like this: [dynamictext dynamicname "CF7_bloginfo show='url'"]
Your form’s dynamicname text input will then be pre-populated with your site’s URL
Learn more and see examples from the DTX Knowledge base.
Theme Options
Want to retrieve values from your active theme’s Customizer? Now you can with the CF7_get_theme_option shortcode.
Learn more and see examples from the DTX Knowledge base.
HTTP GET Variables
Want to use a variable from the PHP $_GET array? Just use the CF7_GET shortcode. For example, if you want to get the foo parameter from the url
http://mysite.com?foo=bar
Enter the following into the “Dynamic Value” input: CF7_GET key='foo'
Your Content Form 7 Tag will look something like this: [dynamictext dynamicname "CF7_GET key='foo'"]
Your form’s dynamicname text input will then be pre-populated with the value of foo, in this case, bar
Learn more and see examples from the DTX Knowledge base.
HTTP POST Variables
Grab variables from the PHP $_POST array. The shortcode is much like the GET shortcode:
Dynamic value: CF7_POST key='foo'
Your Content Form 7 Tag will look something like this: [dynamictext dynamicname "CF7_POST key='foo'"]
Learn more and see examples from the DTX Knowledge base.
Cookie Values
If your WordPress website uses cookies, you might want to pull the value of a specific cookie into a form. You can do that with the CF7_get_cookie shortcode. It only needs a key attribute.
Dynamic value: CF7_get_cookie key='foo'
Your Content Form 7 Tag will look something like this: [dynamictext dynamicname "CF7_get_cookie key='foo'"]
Learn more and see examples from the DTX Knowledge base.
GUID
Generate a globally unique identifier (GUID) in a form field. This is a great utility shortcode for forms that need unique identifiers for support tickets, receipts, reference numbers, etc., without having to expose personally identifiable information (PII). This shortcode takes no parameters: CF7_guid
In the form editor of Contact Form 7, your form tag would look like: [dynamictext dynamicname "CF7_guid"]
Learn more and see examples from the DTX Knowledge base.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Contact Form 7 – Dynamic Text Extension」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.1 | 1.2 | 2.0 | 3.2 | 1.0.1 | 1.0.2 | 1.0.3 | 1.0.4 | 2.0.1 | 2.0.2 | 2.0.3 | 3.0.0 | 3.1.0 | 3.1.1 | 3.1.2 | 3.1.3 | 3.3.0 | 3.4.0 | 3.5.0 | 3.5.1 | 3.5.2 | 3.5.3 | 3.5.4 | 4.0.0 | 4.0.1 | 4.0.2 | 4.0.3 | 4.1.0 | 4.2.0 | 4.2.1 | 4.2.2 | 4.2.3 | 4.3.0 | 4.3.1 | 4.4.0 | 4.4.1 | 4.4.2 | 4.5.0 | 4.5.1 | 5.0.0 | 5.0.1 | 5.0.2 | 5.0.3 | trunk | 1.0.4.1 | 1.0.4.2 | 1.1.0.1 | 1.1.0.2 | 2.0.2.1 |
延伸相關外掛(你可能也想知道)
Disable Autocomplete 》 禁止瀏覽器自動填充表單和輸入欄位的能力。 適用於包含敏感資訊的表單,並提供額外的表單提交安全級別。。
Gravity Forms Disable Autofill Add-On 》此外掛可禁止瀏覽器對選定的 Gravity Forms 中的表單和輸入欄自動填充。特別適用於包含敏感資料的表單,可提供額外的表單提交安全性保障。, Readme 產生器, ...。
WP Disable Autofill 》禁用瀏覽器自動填充表單和輸入欄位的功能。適用於包含敏感資訊的表單,可提供額外的表單提交安全性。, Readme 產生器, 本 Readme 檔案是使用 wp-readme 產生...。
Auto-Fill Infusionsoft Forms 》這個外掛會自動將基本的聯絡資料填入頁面嵌入的 Infusionsoft 表單符合的欄位中。, 它適用於以下項目:, , 由 Campaign Builder 創建的 Infusionsoft Web For...。
PersonDoc for WooCommerce 》透過 Persondoc 帳戶,允許全世界的使用者在您的網站上快速且安全地註冊/登入, 此外掛的功能包括:, , 完全整合 WooCommerce 外掛, 僅運作於「我的帳號」頁面, 。
Domain Mapping Autofill 》此外掛假定您已經安裝了 WordPress MU Domain Plugin。, 當處理多個網域和網站時,必須要先在另一個頁面上搜尋才能找到網站ID,這非常麻煩。, 使用這個外掛,...。
Search Autocomplete by Dotcomjungle 》這款外掛可以覆蓋掉標準 HTML 原有的自動填充功能,提供一個外觀美觀且高度可定制的自動填充選項。本外掛完全免費,超輕量級、容易配置,並且兼具平滑動畫效...。
Booking Calendar Autofill 》此外掛與「Booking Calendar」外掛相容,可以根據當前已登入的使用者自動填入欄位,例如「名字」、「姓氏」、「電子郵件」以及「電話號碼」。電話號碼不是 Wo...。
autofill-CF7-BB 》autofill-CF7-BB 可讓您使用 URL GET 變數自動填入聯絡表單 7 的字段(包括輸入文本、單選、下拉菜單、多選框和文本區域)。它會添加一個短碼到“聯絡表單 7 ...。
Autofields 》這個外掛將會將內容中的第一段作為文章摘要,並且取出第一張圖片(如果有的話)並設置它為「圖片」自定義欄位(某些主題需要)。當您點擊發佈按鈕時,它會檢...。
Autogrid 》總結:, Autogrid是WordPress區塊編輯器的外掛,允許你創建自適應欄位。它內部的元素會自動填充空間並分佈到欄位中。, , 問題與答案:, 問:Autogrid是什麼?...。
Address Autofill – The Plugin helps the customers to auto-fill their address ===. 》增加退貨率的一個主要原因是客戶在你的網站上選擇商品後,填寫送貨地址的過程冗長繁瑣,最終放棄訂單。 Pataa Navigations為此問題提供了完美的解決方案- Pat...。
Company Autocomplete by LEI Register 》啟用此外掛後,標準 Woocommerce 結帳表單中的公司名稱欄位將自動加入自動完成功能。, 目前全球 GLEIF 資料庫中有大約兩百萬家公司,都可透過此外掛進行搜尋...。
Auto Form Fill 》在開發階段填寫冗長的表單既耗時又枯燥。, 這個外掛可以在點擊一個按鈕後自動填充表單,使其包含有關的虛擬數據。您還可以為特定字段設置所需的值。, 此外掛...。