Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
Thanks for your message.
It would appear that your code is missing the <style></style>
tags around your CSS declarations.
If possible, please feel free to add the entire code template for your notification to a site such as Pastebin and then post the link here so I can double check.
Thread Starter
lbbjon
(@lbbjon)
Hi,
Thanks for getting back to me.
That’s the thing, <style> & </style> is included within the raw html, but it seems the editor likes to remove it. ¯\_(ツ)_/¯
Template here:
https://pastebin.com/FuWtGYsG
Many thanks,
Jon.
Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
Odd!
Is there an option to include this as a style attribute on each element instead?
This may work better and prevent the style tag from being stripped out.
In the meantime, i’ll investigate why it might be being stripped out.
Plugin Author
bnfw
(@voltronik)
Actually, does this help at all? https://stackoverflow.com/questions/23297466/how-to-prevent-wordpress-3-9-tinymce-4-from-stripping-style-tags/23578423#23578423
Seems it might be an issue with WordPress’s implementation of TinyMCE for the WYSIWYG editor.
Thread Starter
lbbjon
(@lbbjon)
That’s quite interesting, thanks for finding that link.
I tried using that code within a <script> </script> tag (I presume that’s correct), but still resulted in: https://i.paste.pics/22bceeb365d40e6441680ae61de5cee5.png
Do I need to customise this piece of script at all? (If you know?):
add_filter(‘tiny_mce_before_init’, ‘vsl2014_filter_tiny_mce_before_init’);
function vsl2014_filter_tiny_mce_before_init( $options ) {
if ( ! isset( $options[‘extended_valid_elements’] ) ) {
$options[‘extended_valid_elements’] = ‘style’;
} else {
$options[‘extended_valid_elements’] .= ‘,style’;
}
if ( ! isset( $options[‘valid_children’] ) ) {
$options[‘valid_children’] = ‘+body[style]’;
} else {
$options[‘valid_children’] .= ‘,+body[style]’;
}
if ( ! isset( $options[‘custom_elements’] ) ) {
$options[‘custom_elements’] = ‘style’;
} else {
$options[‘custom_elements’] .= ‘,style’;
}
return $options;
}
Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
I honestly don’t know but it looked like it should work.
With this function in your functions.php file, are you able to get a style tag to work within a WYSIWYG editor on a regular page or post?
Interested to know if it’s a problem specific to BNFW’s WYSIWYG editor or the TinyMCE WYSIWYG editor site-wide.
Thread Starter
lbbjon
(@lbbjon)
That’s a good idea! I’ll take a look into that and get back to you.
Thread Starter
lbbjon
(@lbbjon)
Hello,
I’ve used my email template in a Post and here is the result when published:
https://i.paste.pics/7e90484106b3d57df89ac3d1550d5934.png
I did not use the php function in the screenshot and seemed to work okay. Is there a difference between your notification editor and a regular post editor?
Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
There shouldn’t be any difference but let me investigate and i’ll let you know how I get on.
I have the same issue, Please help!
Thread Starter
lbbjon
(@lbbjon)
@voltronik
Did you get anywhere with this issue at all?
Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
Not yet, still investigating but i’ll update this ticket when I have anything.
Plugin Author
bnfw
(@voltronik)
Hi @lbbjon,
Can you please send me the full code for your email template that isn’t working as expected and having the style attribute stripped in BNFW?