【问题标题】:Contact Form 7: How to check if a shortcode exists on the form body?联系表格 7:如何检查表格正文中是否存在简码?
【发布时间】:2017-06-08 22:10:12
【问题描述】:

我需要检查我的自定义 CF7 表单标签是否插入到表单中,以创建一个简单的条件。 我知道函数has_shortcode( $content, 'my-shortcode' ),但我不知道CF7 使用的var。 我在谷歌上挖掘了很多,但没有任何帮助。

【问题讨论】:

    标签: wordpress forms filter customization contact


    【解决方案1】:

    您可以在 cf7 管理页面的表单列表中查看每个表单的简码,就在表单名称旁边

    【讨论】:

      【解决方案2】:

      也许它有助于做短代码并检查返回内容的长度。

      if(strlen(do_shortcode('[contact-form-7']) > xxx){
        // exists
      }else{
        // not exists
      }
      

      【讨论】:

        猜你喜欢
        • 2018-12-12
        • 1970-01-01
        • 2016-08-06
        • 1970-01-01
        • 2018-06-23
        • 2016-08-16
        • 2020-10-15
        • 2015-12-25
        • 1970-01-01
        相关资源
        最近更新 更多