Copyright notice is very important for any website or a blog. Copyright notice gives your blog a professional and serious look. If your blog doesn’t have a copyright notice, then you should definitely add it. When browsing some popular blogs, you may have observed how they give importance to even minute details, like this one. In this tutorial, you’ll learn how to change or update year in copyright notice automatically.
For most of you out there, this is a very simple task. You just need to login to your WordPress admin panel, go to Themes > Editor and then edit footer.php file. Find the part that says Copyright 2011 and change it to Copyright 2012, for example. But this is a manual task and you’ll need to change the year every time. How about automatically changing this year using a simple PHP code.
How To Auto Update The Copyright Notice in WordPress
Why do it manually once a year, when you can change it automatically in WordPress. For this purpose, you’ll need to login to your WordPress admin panel, go to themes editor and open the file that holds your copyright information. Usually this is the footer.php file.
Find the existing copyright notice code and replace it to:
Copyright © Website name
Note that for doing this you’ll need to give write permission to the file that you are editing. Or you can use a FTP client like FileZilla to download, edit and then upload the file.
Understanding this code is very simple. Basically we’re using the_date function for WordPress. Instead of hard coding the year, we can just replace it with:
This will automatically fetch the year from your web server calendar. Therefore your web server should also be set to show correct year number. If you want to display the year from which you started blogging, then use the below code:
Copyright © 2009 - Website name
Replace 2009 with the year from which you started the website/blog.
This is a very useful code which will save your time each year from manually updating. Try it out.