email - 如何将 [checkbox] 邮件标签值放入 CF7 中电子邮件内的无序列表中?
问题描述
[复选框服务 one_label_element “DJ” “Live Dhol” “MC” “智能舞池照明” “Uplighting” “Pinspot Lighting”]<
解决方案
使用CF7 的 Smart Grid 扩展,它引入了邮件标签过滤器,所以你会做类似的事情,
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
,插件创建自定义过滤器和帮助代码。请观看此视频教程以了解如何获取合适的过滤器。
推荐阅读
- python - 在第二次执行时停止函数的第一次执行(Python)
- reactjs - 在使用登录模板时设置背景图像
- python - 从 Dash Datatable 下载的文件正在导出 HTML 而不是数据框
- shell - 在 GCP 中,当我单击 Cloud Shell 访问控制台时,它只显示一个白框
- r - 使用 R 中的特定月份和年份使用 ARIMA 模型进行预测?
- node.js - 如何在 TS-Node 中声明初始化全局变量?
- spotify - 在Spotify中拉艺术家的专辑时,如何增加默认限制20
- python - 计算熊猫数据帧的增长率
- javascript - 单个复选框在反应组件中不起作用
- r - 使用 mutate_at 将 R 中的缺失值替换为从列名中获得的值(如果不缺失)