Hey everyone,
As a freelancer managing multiple client sites I was looking for an easy way to dynamically display the current year in the footer of all my sites. There are other forum posts about how to do this, but some don’t work if there are multiple instances of the current year span on the same page, and some were just overly complicated for my needs so I wanted to share this new simple method I’m using.
Step 1: Paste this code before the body tag in your project settings
<script>
$(function() {
$('.current-year').text(new Date().getFullYear());
});
</script>
Step 2: Create a text span on any text you want to display the current year.
Step 3: Add a class to the span labeled current year
or current-year
(either works)
Step 4: Publish your site and view the live site to see the results
Cheers!