Hi Phil,
Thanks for your message.
You’ll most likely need to include a <style></style> HTML attribute towards the top of your email notification when using the Text part of the Editor on your notification.
Something like this inside may work:
a[url^="url/wp-admin/comment.php?"] { /*button styles go here */ }
Let me know if this helps.
Many thanks.
I thought it wasn’t permitted to separate out the <style> definitions like this in emails, and it was necessary to use inline style definitions. I’ll give that a try.
Cheers,
Phil.
Hi, I’ve been trying to get this approach to work and still no joy. Have you had any success elsewhere with styling the shortcode as a button? The idiosyncracies of the various email clients seem to play a factor.
Thanks for any help.
Phil.
Hi @carryoncoding,
I can’t help with any specifics relating to customising the notifications using CSS however, you may find this article useful on what email clients support with regards to CSS: https://www.campaignmonitor.com/css/style-element/style-in-body/
You may find this article helpful too: https://www.smashingmagazine.com/2021/04/complete-guide-html-email-templates-tools/
Very many thanks for these useful links.
Phil
No problem @carryoncoding,
Hope you find an answer and get your notifications looking good 🙂
Hi,
Thanks for all your help with this. I thought it might be useful for future readers to show how this was resolved. We spent quite some time trying to use the approach described above.
include a <style></style> HTML attribute towards the top of your email notification when using the Text part of the Editor on your notification.
Something like this inside may work:
a[url^="url/wp-admin/comment.php?"] { /*button styles go here */ }
This is the most elegant approach, but sadly we were unable to get it to work. When the email is received, a number of clients fail to pick up on the a[…] in the style definition, and the buttons are not created.
Instead, we went with
<style>
.email-button {
padding: 8px 12px;
border: 1px solid #C2a332;
border-radius: 4px;
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
color: #C2a332;
text-decoration: none;
font-weight:bold;
display: inline-block;
}
table, td, div, h1, p {font-family: Arial, sans-serif;}
</style>
Then in the body of the e-mail:
<td style="width:33%;padding:0px 5px 10px 5px;vertical-align:top;">
<div class="email-button">[comment_moderation_approve]</div>
</td>
This expanded the shortcode and created the link in a button.
Always happy to improve this further, so any suggestions for improvemet are welcome.
Thanks,
Phil.
Hi @carryoncoding,
Thanks for sharing your solution. Glad you got it working.