To add a dynamic footer year in Salient, we need to use the default footer. In case disable the default footer and we use a widget for the copyright tag, we'd have to use a static year for copyright.
A way around would be to add a php snippet into the functions.php file and then call that function using HTML in the footer widget.
I was wondering, since you guys already have dynamic footer defined somewhere, how can we pull the dynamic year from what's already been defined, instead of making any modifications to the functions.php file or without installing additional plugins?
Tried that. The disadvantage with that is: We have to modify the functions.php file, which means every time we update the theme, that snippet would vanish.
An alterative to that would be to have Code Snippets or another plugin like that since Salient doesn't have an inbuilt custom php section, but that would be adding another plugin, and hence more load, in turn worse performance of the website.
For anyone else interested, here's the solution I've found, and it uses HTML5 and JS alone: <script>document.write( new Date().getFullYear() );</script>
This solution still adds a script and get request, so it will impact load speeds, but it hopefully will be negligible.
Hi guys
To add a dynamic footer year in Salient, we need to use the default footer. In case disable the default footer and we use a widget for the copyright tag, we'd have to use a static year for copyright.
A way around would be to add a php snippet into the functions.php file and then call that function using HTML in the footer widget.
I was wondering, since you guys already have dynamic footer defined somewhere, how can we pull the dynamic year from what's already been defined, instead of making any modifications to the functions.php file or without installing additional plugins?
Thanks!
Hi Alberteck,
Please try adding this on the widget:
Thanks.
Hi
I just tried that
Doesn't seem to work
Hi Alberteck.
Please check this out:https://www.wpbeginner.com/wp-tutorials/how-to-add-a-dynamic-copyright-date-in-wordpress-footer/.
Thanks.
Tried that. The disadvantage with that is: We have to modify the functions.php file, which means every time we update the theme, that snippet would vanish.
An alterative to that would be to have Code Snippets or another plugin like that since Salient doesn't have an inbuilt custom php section, but that would be adding another plugin, and hence more load, in turn worse performance of the website.
For anyone else interested, here's the solution I've found, and it uses HTML5 and JS alone: <script>document.write( new Date().getFullYear() );</script>
This solution still adds a script and get request, so it will impact load speeds, but it hopefully will be negligible.
Hi Alberteck,
Thanks for sharing the solution. I truly appreciate.
Kind Regards.