• How would I be able to use {echo:date(‘Y’)} in the message area so I’m not needing to remember to update the year when it rolls over?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Phil

    (@philsbury)

    Hi @soloant, which field are you doing it in? If it’s the Additional Content that allows shortcodes so you could create a super simple one like

    add_shortcode('year', fn() => date('Y'));

    Then just add [year] to the box?

    If it’s another field, that’ll need a bit more thought (from me!)

    Thanks
    Phil

    Thread Starter SoloAnt

    (@soloant)

    Hi, yes, in the Additional Content area. Apologies for not being more specific there.

    I want to add this “? {echo:date(‘Y’)} BrandNameHere. All Rights Reserved.” so when a new year rolls around I’m not having to go in and update the date within the age-gate additional content area, I’d like it to update automatically.

    I tried adding that little snippet a couple of different ways to that area but it just returned the copy/pasted text so I’m not doing something right. See here https://www.dropbox.com/scl/fi/mo2yxmt54458dfgfphq9m/CleanShot-2024-02-05-at-14.22.13-2x.png?rlkey=7ailhf4kn2o2xinjgza0ferzd&dl=0

    Thanks,

    Plugin Author Phil

    (@philsbury)

    So add this to your functions:

    add_shortcode('year', fn() => date('Y'));

    Of if you are on less that PHP 7.4 use:

    add_shortcode('year', function() {
        return date('Y');
    });

    Then put ? [year] BrandNameHere. All Rights Reserved. in the options box

    Thanks
    Phil

    Thread Starter SoloAnt

    (@soloant)

    Aweee, thank you so much, got it working now.

    Much appreciated. ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Echo Current Year’ is closed to new replies.