I’d like to customize the CSS for the invoice/receipt but can’t figure out where to change that. I’ve copy the file ‘html_main_default.css’ in ‘mytheme/css/ee-messages’ folder so that I can override it. Now how to tell EE to use this?
I’ve added the following function:
function ee_modify_html_variation( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) {
if ( $messenger != 'html' ) {
return $variation_path;
}
//for this example we'll just filter the wpeditor for this variation
if ( $type != 'wpeditor' ) {
return $variation_path;
}
$new_url = get_stylesheet_directory_uri() . '/ee-messages/html_main_default.css';
return $new_url;
}
add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_modify_html_variation', 10, 8 );
that I’ve found on your github but it’s probably not the right way to do it.
Could you please help? All the posts related to this topic are two years old and no longer apply to the current EE4 version.
The code above works, but you’ll need to modify things a bit for your scenario.
The part that needs changing is this:
if ( $type != 'wpeditor' ) {
return $variation_path;
}
That’s basically telling WordPress to not load your CSS unless you’re viewing a preview of the receipt in the receipt editor. Since you want to load your CSS when the actual receipt loads, so you can remove that entire conditional.
Thanks for your reply. Removal of this condition actually triggers the use of the CSS but only this one. Meaning on the Order confirmation page, I only have this stylesheet that loads on the page which results in a not-so-good-looking page!
How would you load the default ones as well like html_base_default.css or html_print_default.css within this function?
All right, thanks, that’s what I’ve done then. I thought there was an easier way of customizing just the extra stylesheet.
Viewing 4 reply threads
The support post ‘Custom CSS on invoice/receipt’ 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.