About

I am Ajith Edassery, a software professional and blogger from Bangalore, India. Blogging is my favorite pastime and I use this space to write about tips on blogging, SEO and how to make money online. Read more in the about page and subscribe to my updates using the form below:

Subscribe to RSS

Subscribe by Email

Your Email: 

Recommendations

eToro - Make Money Online via Forex Trading

Auto-update copyright year

Ajith | Jan 2010 | Blogging Tips

It is that time of the year where you do a lot of update activities on your blog including stock taking of the past year, wishing friends & family, setting goals, taking new year resolutions etc. It is also a good time to update certain important areas of your blog – Yes I am talking about updating the copyright year on the footer of your blog.

When I checked most of my friends’ blogs today I found that the copyright year is still 2009. Mostly, every year you hardcode this value but there is an easy way to auto update the copyright year using a simple one-liner script. Once it’s in place, you don’t have to worry about updating the year again. The following is the copyright script that you need to add to the footer of your WordPress blog (or any blogging platform running PHP):

Auto update copyright year script

The following is the simplest form of the script that you can include in an appropriate part of your footer:

Copyright &copy; <?php echo date(’Y'); ?> YourBlog.com

(Just replace YourBlog.com with your blog name or domain name)

This will render your copyright information as:

Copyright © 2010 YourBlog.com

You can play around with other options such as:


&copy; <?php echo date('Y'); ?> YourBlog.com

..to get a result like this

© 2010 YourBlog.com

or even give an year range using…


Copyright &copy; 2005-<?php echo date('Y'); ?> YourBlog.com

..where the output will be as given below:

Copyright © 2005-2010 YourBlog.com

(Year range copyright assuming that 2005 was your starting year from when the copyright is applicable)

Note: This script takes the date and year information of the server. Hence, if your hosting server is in the US, and if you are browsing from India or so on New Year morning, do not panic if you see still 2009. By midnight or on the following morning you will see the copyright year reflected. You can also use a Javascript code to update the year which will overcome this minor issue but I prefer to stick with PHP.

Have you already updated the copyright year on your blog?

Share this Post:  Digg | Stumble | reddit | Del.icio.us |

Comments (23)

  1. That is really handy, because I always forget to update the year on my blogs.

  2. After reading first few line I rush for the update and after reading the whole tutorial I put the code. Thanks for sharing this.

  3. Good point. I’ve been doing exactly the same on my blog from the day 1. The original free theme I had on my blog earlier had this code to get it done. I took that and started using it on the thesis theme also.

  4. Kurt Avish says:

    Just made me remember I have to update mine too. :)

  5. Melvin says:

    luckily my theme already does that for me.. :D

  6. Melvin says:

    and by the way (offtopic), you already received my head to head questions?

  7. Nihar says:

    Great…

    I did this change 2 days ago and also thought of posting a blog post.

    Here it is…. May be i should do it so that my blog readers can also get to know.

  8. Hi Ajith, I just want to share something here mate :)
    About your article on auto-update copyrighter years, I do not even updated it … but I deleted it from my footer LOL but thanks for sharing your tips, maybe I’ll use your tips next time on my other blog.

  9. Nigel says:

    Nice tip Ajith, thanks very much, just implemented. :)

  10. Cool php code. loves it. I guess that means my hardcoding days are over.

  11. [...] it and are looking for tips on how to do then you can read this post on dot com mogul John Chow or this post by [...]

  12. Good tip from a great programmer (I read your interview in melvinblog recently and I see you describing yourself as 90% programmer…automating blog is again very interesting..)

Leave a Reply