I know that websites use short code for automated current year (e.g. typing %%year%% and it shows the current year, so saves you from manually editing the blog posts yourself).
How can I add such a short code please?
I know that websites use short code for automated current year (e.g. typing %%year%% and it shows the current year, so saves you from manually editing the blog posts yourself).
How can I add such a short code please?
Hi @Amandalman,
This is Theodore from PageFly - Shopify Page Builder App.
you can follow my instructions
Go to Online Store > Themes. Click “Actions” next to the active theme and select Edit Code. Open the scripts.liquid file. Add a new tag anywhere or edit an existing one.
Access the shortcode
%%insertYear%%
I’ll be so happy if my suggestion can help to solve your problem. If you have any further questions, please feel free to tell me.
Best regards,
Theodore | PageFly
Thank you for your help Theodore. However, when I go to Edit code, I don’t see “scripts.liquid” file. This is what I see: https://prnt.sc/Tx4BpYTzDzt2
It could be under a different name?
Go to Online Store > Settings > Code snippets and click “Add snippet”
{% assign currentYear = "now" | date: "%Y" %}
{% assign insertYear = currentYear %}
You can now access the year variable using the shortcode anywhere like:
Copyright %%insertYear%% MyStore
It still didn’t work. Did I do it correctly? https://prnt.sc/IC66tGdzE6Y9
You probably did it correctly but the code being giving seems like a chatgpt response as it’s incomplete and doesn’t actually connect the javascript to the rendered text in any way ; unless you have a specific theme with specific pre-existing behaviors.