Happy (day of the week) greeting in email

hi

I’d like to set up a dynamic content fiend that updates to the day of the week so i can insert it into emails, like this:

happy Monday… (if email goes out on a monday)
or happy Tuesday (if the email goes out on a tuesday)

I set up a dynamic content field with this code:

<p style="box-sizing: border-box;">Happy <span id="today" style="box-sizing: border-box;">Tuesday</span>!</p>
<script style="box-sizing: border-box;">
	document.getElementById("today").innerHTML = new Date().toLocaleDateString('en-us',
	{
		weekday: "long",
	});

</script>

and it seems to be working, the field is updating, but how do I now insert this dynamic content field (which shows as ID 1) into my template email?

what token do I use?

thank you.

Hi,
Did you eventually get this to work?
I’m looking to do the same but can find no references to do this using variables.

Anyone else can help solve this would be greatly appreciated

Hello,

This is possible with the twigtemplates plugin:

Tomorrow
{{ "now"|date_modify('+1 day')|date("m/d/Y") }}

Today
{{ "now"|date("m/d/Y") }}

Today is happy {{ "now"|date("l") }}

The last one will produce Today is happy MMonday for example.

Here is a snipplet library:

ok thanks for pointing this paid plugin out.
Is this yours or you’re associated with it?

No, it’s not my plugin, I’m not associated any way.
I just like this plugin and use it whereever I can.
It let’s you fo abandoned cart content, dynamic content, etc.

ok all good anyway. great it’s working for you.
my business partner forked an existing Github repo and we built our own Twig stuff that’s better suited to our needs, with spintax.
Thanks for your help too. appreciated

Okay great.
BTW - there is spintax built in :slight_smile:

And the github repo is not free and open, so I’m not sure what you forked.
Make sure it’s the twig templates plugin, not the advanced twig templates plugin. It’s different and they work 100% different.

The repo my business partner forked has nothing to do with the plugin you mentioned. It twig based.
there is spintax built in too and now working merrily away :slight_smile: