Home Forums Event Espresso Premium Invoice custom CSS appears at the bottom and crashes DOMPdf

Invoice custom CSS appears at the bottom and crashes DOMPdf

Posted: August 29, 2017 at 12:48 pm


August 29, 2017 at 12:48 pm

I added custom CSS with this hook:

add_action( 'AHEE__EE_Pdf_messenger__enqueue_scripts_styles', function() {
  wp_enqueue_style( 'messages-css', get_template_directory_uri() . '/css/messages.css' );

However, when I view the invoice in HTML, the CSS link appears at the bottom, right after </body>:

<link rel='stylesheet' id='messages-css-css'  href='.../css/messages.css... />

This is not a huge problem in HTML, but when I try to download the PDF, DOMPdf generates an error and I’m thrown back to the home page. The problem disappears when I comment this line in class EE_Pdf_messenger, line 302:

301 protected function _deregister_wp_hooks() {
 302  // remove_all_actions('wp_head'); -> comment this
 303  ...

Any idea?

(using EE4 4.9.39)


  • Support Staff

August 29, 2017 at 1:52 pm

That particular hook isn’t well suited for overriding CSS. I can recommend using a filter hook instead where you can swap in your custom stylesheet instead of the default one. Example code follows:

function ee_modify_html_variation( 
  EE_Messages_Template_Pack $template_pack 
) {
  if ( $messenger != 'html' ) {
    return $variation_path;
  if ( $message_type != 'invoice' ) {
    return $variation_path;
  if ( $type != 'main' ) {
    return $variation_path;
  $new_url = get_stylesheet_directory_uri() . '/css/messages.css';
  return $new_url;


August 29, 2017 at 2:14 pm

Thanks, that works. The action hook sounded tempting though 😉

The support post ‘Invoice custom CSS appears at the bottom and crashes DOMPdf’ 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.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  sara.bosman 2 years, 10 months ago ago

Topic Tags


This topic is:
Do NOT follow this link or you will be banned from the site!