Skip to content

Instantly share code, notes, and snippets.

@campusboy87
Forked from andxbes/function_v2.php
Created June 21, 2018 21:20
Show Gist options
  • Save campusboy87/5bcb538373332bd6c9ce1807e2ddbe5e to your computer and use it in GitHub Desktop.
Save campusboy87/5bcb538373332bd6c9ce1807e2ddbe5e to your computer and use it in GitHub Desktop.
cf-7 append additional information to mail
<?php
//see https://yadi.sk/i/M5hhJKkU3MkRdN
add_filter("wpcf7_mail_components", function($components, $curent_cf, $sender ){
date_default_timezone_set('America/Sao_Paulo');
$data = date("Y-m-d H:i:s");
$components['body'] = str_replace("[protocol]", $data , $components['body'] );
return $components;
},15,3);
<?php
add_filter('wpcf7_special_mail_tags', function($output, $name, $html) {
if ('protocol' == $name) {
date_default_timezone_set('America/Sao_Paulo');
$data = date("Y-m-d H:i:s");
return $data;
}
return $output;
}, 10, 3);
<?php
add_filter("wpcf7_mail_components", function($components, $curent_cf, $sender ){
date_default_timezone_set('America/Sao_Paulo');
$data = date("Y-m-d H:i:s");
$components['body'] = "Protocolo {$data} \n". $components['body'];
return $components;
},15,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment