Last active
December 21, 2015 15:49
-
-
Save akd3vs/6329333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
send_email_template('contacto_empresa_no_registrada', $attrs = array( | |
'title' => 'Alguien pide informacion de su franquicia en nuestro portal Franquiciame.com', | |
'email' => $companyUnregistered | |
)); | |
function render_email_template($template_name, $attrs = array(), $cached = true) { | |
include 'Twig/Autoloader.php'; | |
Twig_Autoloader::register(); | |
$parameters = array(); | |
if($cached == true) { | |
$parameters['cache'] = __DIR__.'/inc/emails_contents/cache'; | |
} | |
$loader = new Twig_Loader_Filesystem(__DIR__.'/inc'); | |
$twig = new Twig_Environment($loader, $parameters); | |
return $twig->render('emails_contents/'.$template_name.'.html', $attrs); | |
} | |
function send_email_template($template_name, $attrs = array(), $cached = false) { | |
$template = render_email_template($template_name, $attrs, $cached); | |
add_filter( 'wp_mail_content_type', array('Boletin', 'set_html_content_type' )); | |
wp_mail($attrs['email'], $attrs['title'], $template); | |
remove_filter( 'wp_mail_content_type', array('Boletin', 'set_html_content_type' )); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment