Support

Home Forums Event Espresso Premium Custom CSS on messages

Custom CSS on messages

Posted: May 11, 2015 at 3:53 pm


Nick

May 11, 2015 at 3:53 pm

I am trying to use Custom CSS on email messages that get sent out during registration, but it’s not getting picked up (I am using the send test email function to test).

Here’s the function I am using:

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() . '/new_html_variation.css';
	return $new_url;
}
add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_modify_html_variation', 10, 8 );

And the CSS file new_html_variation.css is in the folder for my Child Theme.

What am I doing wrong?

Thanks,

Nick


Josh

  • Support Staff

May 11, 2015 at 8:09 pm

Hi Nick,

You have this part in your function:

if ( $type != 'wpeditor' ) {
	return $variation_path;
}

That’s making it so the custom CSS only loads if it’s in the WP editor. You’ll need to remove that in order to load the custom CSS in the actual message that’s sent.

Along with that, this other earlier check:

if ( $messenger != 'html' ) {
	return $variation_path;
}

The above conditional makes it so your custom CSS only loads if the messenger is html, which can be a ticket, a receipt, or an invoice. If you want to add the custom CSS to the actual email notifications, you can change it to load if it’s the email messenger, eg:

if ( $messenger != 'email' ) {
	return $variation_path;
}

The support post ‘Custom CSS on messages’ 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.

Event Espresso