I am wanting to edit the email templates, I have tried following the suggestion below: https://eventespresso.com/topic/custom-styles-to-email-message-and-invoice/
The files to modify don’t appear to be located there. I created my own files and tried to reference them but my templates don’t appear to be getting the CSS file. What am i doing wrong?
/* ----- Modify default email CSS ---- */
//assuming you have the files located in wp-content/uploads/
function ee_inline_css_swap( $url, $type ) {
$upload_dir = wp_upload_dir();
switch ( $type ) {
case 'preview' :
$url = $upload_dir['baseurl'] . '/email.css';
break;
case 'wpeditor' :
$url = $upload_dir['baseurl'] . '/email.css';
break;
default :
$url = $upload_dir['baseurl'] . '/email.css';
break;
}
return $url;
}
add_filter( 'FHEE__EE_Email_Messenger__get_inline_css_template__css_url', 'ee_inline_css_swap', 10, 2 );
I am wanting to edit the email templates, I have tried following the suggestion below: https://eventespresso.com/topic/custom-styles-to-email-message-and-invoice/
The files to modify don’t appear to be located there. I created my own files and tried to reference them but my templates don’t appear to be getting the CSS file. What am i doing wrong?
Those hooks have been depreciated and whilst they should still work, the internal structure of the message system has changed since that thread which is why you can not find the files.
With the latest version of the messenger we introduced ‘Template Packs’ and ‘Variations’ which are basically a way to allow you to register your own html and css files for messages. You can read more about those here:
Another issue is that some HTML keeps getting stripped out of the email templates when I save the template.
My background image and this code <!--[if gte mso 9]>
Whats happening there is the messages system is detecting the square brackets – [] and is trying to parse the content as a messages shortcode. EE validates the shortcodes used within the messages system and only allows you to use ‘valid’ shortcodes (shortcodes the messages system has been set to allow), because that shortcode is not ‘valid’ it is being removed.
Another user wanted to use the same shortcodes within the messages, so I have previously created an example function that adds those shortcodes to the messages system which is available here:
Which just adds ‘[if gte mso 9]’, ‘[endif]’ and ‘[if mso]’ to the messages system. It validates as a shortcode and then just returns the shortcode text as a string.
You can place that within you theme/child themes functions.php file or a Custom Functions Plugin.
Thanks, I have figured out how to set up the email css modifications. Just wandering if there is a simpler option, like with a lot of the other files through out EE – Can I just upload an email css file to my child theme and have it over ride the default one?
I am still having issues with the wordpress editor striping out background images. Seems to be the only way to keep gmail happy is to put the background image inline on a <table> Is there a way to add this to the allowed code to accept?
Can I just upload an email css file to my child theme and have it over ride the default one?
No, not with the messages system, you need to create a variation or use the hooks above to add in your own custom CSS.
I am still having issues with the wordpress editor striping out background images. Seems to be the only way to keep gmail happy is to put the background image inline on a <table> Is there a way to add this to the allowed code to accept?
As you mentioned its the WP editor that is stripping that code as it seems backgroundis not a valid html attribute for td. So it seems WP is stripping that element for good reason.
If it is invalid HTML then adding that to your email templates is going to cause more problems (email clients are very fussy over HTML emails)
The default templates were built based Zurb templates:
As unfortunately building consistent complex HTML emails is no-where near as simple as it should be.
Viewing 4 reply threads
The support post ‘Edit email templates’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.