Automatically Update Copyright Year

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/

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.