To show dynamic year on the website we can follow the following steps:
Simple:
Copyright © <script>document.write(new Date().getFullYear())</script>. All Rights Reserved
Date range:
Copyright © 2020-<script>document.write(new Date().getFullYear())</script>. All Rights Reserved
Next method
For the functions.php file:
function year_shortcode() {
$year = date(‘Y’);
return $year;
}
add_shortcode(‘year’, ‘year_shortcode’);
Usage
Use [year] in your posts.
Source : https://kerstinmartin.com/blog/copyright-notice https://css-tricks.com/snippets/wordpress/year-shortcode/