• Hi there,

    How do I insert a date field that reflects the current year without me having to manually change it for every block of text.

    For instance, I want the bolded part below to be automatically updated based on when users copy it

    [copy text=”Copy Citation”]Author (2021). Post Title. Updated CurrentYear.[/copy]

    And so, if the user copies the citation next in 2024, this will show:

    Author (2021). Post Title. Updated 2024.

    How do I achieve this?

    Many thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • If you can do PHP within your solution, you can just do

    <?PHP echo date("Y"); ?>

    • This reply was modified 3 years, 1 month ago by Jeroen Rotty. Reason: fix typo
    Thread Starter droyed

    (@droyed)

    Hi @jeroenrotty

    Thanks again! But tbh, I wouldn’t have a clue where to insert this mate. Is there something I could stick into the Additional CSS space?

    No, PHP code can’t reside in CSS fields. Sorry that I did not see that this was posted in a plugin forum, thought you were generally asking how to implement an auto-updating year :-).

    You might want to enhance or fork this plugin shortcode so this can be included as a parameter, or wait until the plugin developer replies to this topic here.

    Thread Starter droyed

    (@droyed)

    Hi @jeroenrotty

    Thanks again for your response.

    Actually, you’re right about both of these – I was generally looking for ways to re-use/auto-update blocks, but was also looking for answer to this specific plugin-related query.

    Yes, I will wait for the plugins devs to provide an answer….hopefully soon.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Update year automatically’ is closed to new replies.