How to automatically update the copyright year in the footer etc.
It's been a while since I last updated. Hello, this is naouniverse ( @naouniverse708 ).
When I was reviewing the site, I noticed that the copyright year was still the same as last year.
It's quite a hassle to update the year name manually every time the year changes, so I took this opportunity to update it automatically.
For PHP
First, when using PHP.
Copyright © 2012-<?php echo date("Y"); ?> naouniverse.com All Rights Reserved.
current year
<?php echo date("Y"); ?>
Just rewrite it!!
It's super easy.
For Javascript
It seems possible to do something similar with Javascript.
I'm just making a note of this for myself because I might have a chance to use it someday.
nowyear = new Date().getFullYear();
document.write('Copyright © 2012-'+ nowyear +' naouniverse.com All Rights Reserved.');
What do you think?
It's relatively easy, but the description is a little long.
Afterword
What do you think?
Personally, I think it's easier to write in PHP for WordPress.
Once you have written the above information, it will be automatically updated every year, so there is no harm in doing so.