将表单7输入字段值作为PHP Get-Variables进行联系< /a>.
/ a>。
However, they all involved hacking the current Contact Form 7 code, which means next time the plugin is updated their edits will be
但是,他们都涉及破解当前的Contact Form 7代码,这意味着下次插件更新时,其编辑内容将
overwritten.
被覆盖。
That’s bad.
不好。 p>
This Dynamic Text Extension plugin provides a more elegant solution that leaves the Contact Form 7 Plugin intact.
此动态文本扩展插件提供了更优雅的解决方案,使Contact Form 7插件完好无损。 p>
WHAT DOES IT DO?
它做什么? h4>
This plugin provides a new tag type for the Contact Form 7 Plugin.
此插件为Contact Form 7插件提供了新的标签类型。
It allows the dynamic generation of content for a text input box via any shortcode.
它允许通过任何简码为文本输入框动态生成内容。
For example, it comes with several built-in shortcodes that will allow the Contact Form to be populated from any $_GET PHP variable or any info from the
例如,它带有几个内置的短代码,这些短代码将允许从$ _GET PHP变量或
中的任何信息填充联系表单。
get_bloginfo() function, among others.
get_bloginfo()函数等。
See below for included shortcodes.
有关随附的简码,请参见下文。 p>
Don’t see the shortcode you need on the list?
在列表上没有看到您需要的简码?
You can write a custom one!
您可以编写一个自定义的!
Any shortcode that returns a string value can be used here.
返回字符串值的任何简码都可以在这里使用。
The included shortcodes just cover the most common scenarios, but the plugin provides the flexibility for you to grab any value you have access to programmatically.
包含的短代码仅涵盖了最常见的情况,但是该插件为您提供了灵活性,使您能够以编程方式获取您可以访问的任何值。 p>
HOW TO USE IT
如何使用它 h4>
After installing and activating the plugin, the Contact Form 7 tag generator will have 2 new tag types: Dynamic Text Field and Dynamic Hidden Field.
安装并激活插件后,Contact Form 7标签生成器将具有2种新标签类型:动态文本字段和动态隐藏字段。
Most of the options will be
大多数选项将是
familiar to Contact Form 7 users.
熟悉联系表格7用户。
There are two important fields:
有两个重要的字段: p>
Dynamic Value
动态价值 strong> p>This field takes a shortcode, with two important provisions:
该字段采用简码,其中包含两个重要规定: p>
- The shortcode should NOT include the normal square brackets ([ and ]).
- 简码不应包含普通的方括号([和])。
So, instead of [CF7_GET key=’value’] you would use CF7_GET key=’value’ .
因此,您可以使用[CF7_GET key ='value')代替[CF7_GET key ='value'。 li>
- Any parameters in the shortcode must use single quotes.
- 简码中的任何参数都必须使用单引号。
That is: CF7_GET key=’value’ and not CF7_GET key=”value”
也就是说:CF7_GET键=“值”而不是CF7_GET键=“值” li>
ol>
Uneditable Option
不可修改的选项 strong> p>As these types of fields should often remain uneditable by the user, there is a checkbox to turn this option on (Not applicable for hidden fields).
由于这些类型的字段通常应由用户保持不可编辑状态,因此有一个复选框可以启用此选项(不适用于隐藏字段)。 p>
INCLUDED SHORTCODES
包含的简短代码 h4>
The plugin includes 2 basic shortcodes for use with the Dynamic Text extension.
该插件包括2个基本短代码,可用于动态文本扩展程序。
You can write your own as well – any shortcode will work
您也可以编写自己的代码-任何短代码都可以使用 p>
PHP GET Variables
PHP GET变量 strong> p>Want to use a variable from the PHP GET array?
是否要使用PHP GET数组中的变量?
Just use the CF7_GET shortcode.
只需使用CF7_GET短代码即可。
For example, if you want to get the foo parameter from the url
例如,如果要从url
获取foo参数,
http://mysite.com?foo=bar
http://mysite.com?foo=bar p>
Enter the following into the “Dynamic Value” input
在“动态值”输入中输入以下内容 p>
CF7_GET key=’foo’
CF7_GET key ='foo' p>
Your Content Form 7 Tag will look something like this:
您的内容表单7标签将如下所示: p>
[dynamictext dynamicname “CF7_GET key=’foo'”]
[动态文本动态名称“ CF7_GET key ='foo'”] p>
Your form’s dynamicname text input will then be pre-populated with the value of foo, in this case, bar
然后,您表单的动态名称文本输入将被预先填充foo的值,在这种情况下为bar p>
PHP POST Variables
PHP POST变量 strong> p>New in version 1.0.3!
1.0.3版中的新功能! p>
Grab variables from the $_POST array.
从$ _POST数组中获取变量。
The shortcode is much like the GET shortcode:
简码很像GET简码: p>
CF7_POST key=’foo’
CF7_POST key ='foo' p>
Your Content Form 7 Tag will look something like this:
您的内容表单7标签将如下所示: p>
[dynamictext dynamicname “CF7_POST key=’foo'”]
[动态文本动态名称“ CF7_POST key ='foo'”] p>
Blog Info
博客信息 strong> p>Want to grab some information from your blog like the URL or the sitename?
是否想从您的博客中获取一些信息,例如URL或站点名称?
Use the CF7_bloginfo shortcode.
使用CF7_bloginfo简码。
For example, to get the site’s URL:
例如,要获取网站的网址: p>
Enter the following into the “Dynamic Value” input
在“动态值”输入中输入以下内容 p>
CF7_bloginfo show=’url’
CF7_bloginfo show ='url' p>
Your Content Form 7 Tag will look something like this:
您的内容表单7标签将如下所示: p>
[dynamictext dynamicname “CF7_bloginfo show=’url'”]
[动态文本动态名称“ CF7_bloginfo show =’url'”] p>
Your form’s dynamicname text input will then be pre-populated with your site’s URL
然后,表单的动态名称文本输入将预先填充您网站的URL p>
Post Info
发布信息 strong> p>New in version 1.0.3!
1.0.3版中的新功能! p>
Retrieve information about the current post/page (that the contact form is displayed on).
检索有关当前帖子/页面的信息(显示联系表格)。
The shortcode works as follows:
简码的工作方式如下: p>
CF7_get_post_var key=’title’ <– retrieves the Post’s Title
CF7_get_post_var key ='title'<–检索帖子的标题
CF7_get_post_var key=’slug’ <– retrieves the Post’s Slug
CF7_get_post_var key ='slug'<–检索帖子的Slug p>
You can also retrieve any parameter from the $post object.
您还可以从$ post对象检索任何参数。
Just set that as the key value, for example ‘post_date’
只需将其设置为键值即可,例如“ post_date” p>
The Contact Form 7 Tag would look like:
联系表7标签如下: p>
[dynamictext dynamicname “CF7_get_post_var key=’title'”]
[动态文本动态名称“ CF7_get_post_var key ='title'”] p>
Current URL
当前网址 strong> p>New in version 1.0.3!
1.0.3版中的新功能! p>
Retrieve the current URL.
检索当前URL。
The shortcode takes no parameters:
简码不带参数: p>
CF7_URL
CF7_URL p>
So your Contact Form 7 Tag would look like:
因此,您的联系表格7标记将如下所示: p>
[dynamictext dynamicname “CF7_URL”]
[动态文本动态名称“ CF7_URL”] p>
Custom Fields
自定义字段 strong> p>New in version 1.0.4!
1.0.4版中的新功能! p>
Retrieve custom fields from the current post/page.
从当前帖子/页面检索自定义字段。
Just set the custom field as the key in the shortcode.
只需将自定义字段设置为简码中的键即可。 p>
The dynamic value input becomes:
动态值输入变为: p>
CF7_get_custom_field key=’my_custom_field’
CF7_get_custom_field键=“ my_custom_field” p>
And the tag looks like this:
标签看起来像这样: p>
[dynamictext dynamicname “CF7_get_custom_field key=’my_custom_field'”]
[动态文本动态名称“ CF7_get_custom_field key =’my_custom_field'”] p>
For the purposes of including an email address, you can obfuscate the custom field value by setting obfuscate=’on’ in the shortcode.
出于包括电子邮件地址的目的,您可以通过在简码中将obfuscate =“ on”设置为模糊自定义字段值。 p>
Current User Info
当前用户信息 strong> p>Get data about the current user – assuming they are logged in. Defaults to user name, but you can set the key to any valid value in
获取有关当前用户的数据(假设他们已登录)。默认为用户名,但您可以在以下键中将键设置为任何有效值
https://codex.wordpress.org/Function_Reference/get_currentuserinfo
https://codex.wordpress.org/Function_Reference/get_currentuserinfo p>
CF7_get_current_user
CF7_get_current_user p>
[dynamictext dynamicname “CF7_get_current_user”]
[动态文本动态名称“ CF7_get_current_user”] p>
Referrer URL
引荐来源网址 strong> p>Get the referral URL, if it exists.
获取引荐网址(如果存在)。
Note that this is not necessarily reliable as not all browsers send this data.
请注意,这不一定可靠,因为并非所有浏览器都发送此数据。 p>
[dynamictext dynamicname “CF7_referrer”]
[动态文本动态名称“ CF7_referrer”] p>
Like the Dynamic Text Extension?
喜欢动态文本扩展程序吗?
Please consider supporting its development by Donating.
请考虑通过捐赠来支持其开发。 p>
Or check out my upcoming premium plugin, UberMenu – WordPress Mega Menu Plugin
或查看我即将推出的高级插件 UberMenu – WordPress Mega Menu插件 p>