Contact Form 7的条件字段不工作并在输出中显示[/GROUP]

时间:2020-11-28 作者:Vincent

我在试着Conditional Fields for Contact Form 7 在WordPress中启动并运行。我正在使用联系人表单7版本5.1.3和联系人表单7条件字段版本1.9.14。

我正试着跟着this tutorial, 这将为您提供粘贴到联系人表单7中的最终代码Form 选项卡:

Your name: [text your-name]
Your email address: [email* your-email]
<p>What kind of support do you want?
[select* support-type first_as_label "-- Choose support type --" "Technical support" "Sales"]</p>
[group technical-support-selected]
  <p>Your operating system: [select* operating-system first_as_label "-- Choose your operating system --" "Android" "iOS" "Linux" "Windows" "Other"]</p>
  [group os-selected]
<p>Please specify your [group os-android inline]Android[/group][group os-iOS inline]iOS[/group][group os-linux inline]Linux[/group][group os-windows inline]Windows[/group] version:
    [text* version]</p>
  [/group]
  [group os-other-selected]
    <p>Please specify your OS and version.
    [text* other-os "Operating System"][text* other-version "Version"]</p>
  [/group]
[/group]
[group sales-support-selected]
  <p>Where is your business located?
  [select* continent first_as_label "-- Choose your continent --" "Europe" "America" "Africa" "Asia" "Oceania" "Antarctica"]</p>
[/group]

<p>[textarea comments]</p>

[submit "Send"]
并将此代码粘贴到Conditional Fields 中的选项卡Text 查看:

show [technical-support-selected] if [support-type] equals "Technical support"
show [sales-support-selected] if [support-type] equals "Sales"
show [os-selected] if [operating-system] not equals ""
               and if [operating-system] not equals "Other"
show [os-android] if [operating-system] equals "Android"
show [os-iOS] if [operating-system] equals "iOS"
show [os-linux] if [operating-system] equals "Linux"
show [os-windows] if [operating-system] equals "Windows"
show [os-other-selected] if [operating-system] equals "Other"
然而,当我粘贴代码时,最终输出并没有隐藏任何内容[/group] 显示到输出。以下是屏幕抓图:

enter image description here

你知道我该怎么做吗?

1 个回复
SO网友:Aurovrata

尝试将以下代码添加到functions.php 文件

add_filter( \'wpcf7_autop_or_not\',\'__return_false\');

将删除<p></p> 包装CF7插件为表单中的每一行添加的标记。

相关推荐