如何向 Contact Form 7 插件添加动态值?
How can I add a dynamic value to the Contact Form 7 Plugin?
如何在不使用额外插件的情况下向 Contact Form 7 添加动态值。我需要在发送的电子邮件中显示 Post 标题。
我正在使用 Contact Form 7 文档 here 中的示例,但 clock
标签仅显示在表单页面中,而不显示在发送的电子邮件中。
我不知道是否缺少某些东西,或者我是否应该添加任何其他东西来使这项工作正常进行?
add_action( 'wpcf7_init', 'custom_add_form_tag_clock' );
function custom_add_form_tag_clock() {
wpcf7_add_form_tag( 'clock', 'custom_clock_form_tag_handler' ); // "clock" is the type of the form-tag
}
function custom_clock_form_tag_handler( $tag ) {
return date_i18n( get_option( 'time_format' ) );
}
有一个专门为此构建的插件。 https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/请检查是否符合您的需求!
我在联系表 7 文档中找到了答案https://contactform7.com/special-mail-tags/
我在联系表 7 发送的邮件正文中添加了特殊邮件标签 [_post_title]
,这解决了我的问题。
如何在不使用额外插件的情况下向 Contact Form 7 添加动态值。我需要在发送的电子邮件中显示 Post 标题。
我正在使用 Contact Form 7 文档 here 中的示例,但 clock
标签仅显示在表单页面中,而不显示在发送的电子邮件中。
我不知道是否缺少某些东西,或者我是否应该添加任何其他东西来使这项工作正常进行?
add_action( 'wpcf7_init', 'custom_add_form_tag_clock' );
function custom_add_form_tag_clock() {
wpcf7_add_form_tag( 'clock', 'custom_clock_form_tag_handler' ); // "clock" is the type of the form-tag
}
function custom_clock_form_tag_handler( $tag ) {
return date_i18n( get_option( 'time_format' ) );
}
有一个专门为此构建的插件。 https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/请检查是否符合您的需求!
我在联系表 7 文档中找到了答案https://contactform7.com/special-mail-tags/
我在联系表 7 发送的邮件正文中添加了特殊邮件标签 [_post_title]
,这解决了我的问题。