Line Breaks in Email the Checkboxes
-
I am trying to use this hook to separate the attribut in the checkboxes by line in the email notification.
I tried this code, but it is not work. It is right one?
add_filter('wpcf7_mail_tag_replaced', 'format_chackbox',10,4);function format_chackbox($replaced, $submitted, $is_html, $mail_tag){ //you can check if this is the right field if need be. if('checkbox_name' != $mail_tag->field_name()) return $replaced; //$submitted contains the raw submitted data. //$replaced is the formatted data, you can use either. $a = explode(',', $replaced); //check if you have multiple values and the email accepts html (set with the use html checkbox in the mail notification settings). if(is_array($a) && $is_html){ $replaced = '<ul>'.PHP_EOL; foreach($a as $v) $replaced .= '<li>'.trim($v).'</li>'.PHP_EOL; $replaced .= '</ul>'.PHP_EOL; } return $replaced;}
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Line Breaks in Email the Checkboxes’ is closed to new replies.