【问题标题】:How can I get [checkbox] mail tag values into a unordered list inside the email in CF7?如何将 [checkbox] 邮件标签值放入 CF7 中电子邮件内的无序列表中?
【发布时间】:2021-04-17 21:14:52
【问题描述】:

[复选框服务 one_label_element "DJ" "Live Dhol" "MC" "智能舞池照明" "Uplighting" "Pinspot Lighting"]

【问题讨论】:

    标签: email checkbox tags contact-form-7


    【解决方案1】:

    使用Smart Grid extension for CF7,它引入了邮件标签过滤器,所以你可以这样做,

    add_filter( 'cf7sg_mailtag_my-checkbox', 'filter_cf7_mailtag_my_checkbox', 10, 3);
    function filter_cf7_mailtag_select_option($tag_replace, $submitted, $cf7_key){
      /*the $tag_replace string to change*/
      /*the $submitted an array containing all submitted fields*/
      /*the $cf7_key is a unique string key to identify your form, which you can find in your form table in the dashboard.*/
      if('my-form'==$cf7_key ){
        $tag_replace = '<ul>'.PHP_EOL;
        foreach($submitted['my-checkbox'] as $value){
          $tag_replace .= "<li>{$value}</li>".PHP_EOL;
        }
        $tag_replace .= '</ul>';
      }
      return $tag_replace;
    }
    

    过滤器是为每个邮件标签定制的,在这个例子中我有一个名为my-checkbox的复选框字段,插件创建自定义过滤器和帮助代码。 请查看此video tutorial 了解如何获取合适的过滤器。

    【讨论】:

      猜你喜欢
      • 2015-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多