Since it is almost 2011, people are asking me to change the copyright date at the bottom of their WordPress blog.
You can, however, do this automatically by using a piece of code that displays the current year. Once this is added to your template, you don’t need to manually update it again.
This will display the current year.
<?php echo date("Y"); ?>
At the bottom of this site, I have the following.
Copyright © 2008 - 2010 (Anti) Social Development All rights reserved
The following code is used.
Copyright © 2008 - <?php echo date("Y"); ?> <?php bloginfo('name'); ?> All rights reserved
This is copyright, the code for the copyright symbol, the year I started the site, the current year, the name of the site, and All rights reserved.
If you add that little piece of code to your template – this is usually the footer file – you don’t have to worry about changing the date manually again.
photo credit: Horia Varlan
Dennis Edell @ Direct Sales Marketing says
Tweeted!
This should come in handy for just about everyone. :)
Kim Woodbridge says
Hi Dennis – Thanks!
Kim Smith says
Nice piece of code! I think I’ll definitely be using this one! Thanks for making it simple and easy to understand!
Kim Woodbridge says
Hi Kim – Thanks! I’m glad it helps.
David Tandet says
Great code!
And it couldn’t have been easier (especially since I just hired you to update the version of WordPress I was using and you put the code in for me!)
Love your work.
Among other things, your tip will insure that people look back on 2011 as the year that Kim Would Bridge their transition from 2010!
Dave’s last blog . . http://davidtandet.com/whats-a-community-foundation/
Thanks, Kim.
Kim Woodbridge says
Thanks David! And a great play on words :-)
Paul From squirrelprooffeedersreview says
Thanks for this, you just saved me at least 2 hours work. My problem is I’m like a terrier and won’t give up until I’ve won my personal little battles with wp code…
Kim Woodbridge says
Hi Paul – I’m glad it worked for you.
Donace@Hostgator Coupon says
with useful tips as ever!
Just a small point I would change:
to
For a more cleaner look (like you have below) otherwise it would read 2008 – “2011”
Just my opinion, but yes i’ve added it in to ;)
Donace@Hostgator Coupon says
the comments striped the php but in ‘echo date’ get rid of the parenthesis ie make it (Y) and not (“Y”)
Kim Woodbridge says
Hi Donace – The real problem is that I need a better way to display code – if the quotes are retyped then it will work fine.
Donace says
I use codebox plugin , it aint pretty code but it works. Jeff had a solution using pre tags and a some custom function I think.
Check perishable, or if I find it will let you know
Kim Woodbridge says
Hi Donace – Thanks! I’ll see what Jeff has.
TJ McDowell says
Cool tip! As far as copyrights and websites go, how important do you think it is to include the copyright line? If I remember right, I think the rule is that your work is automatically copyrighted even without the copyright line.
Kim Woodbridge says
Hi TJ – That’s a good question – I like to have the dates and copyright there to show how long the site has been around. And if someone is taking your content, having the copyright notice will help explain to them why they shouldn’t be doing that.
Damian Gostomski says
I’ve written a short snippet which is an improvement over this, as it supports date ranges, so all you enter is the start date, and then it will display it as just that year, or that year to the current one if applicable
Check it out at http://www.gostomski.co.uk/snippet/better-auto-updating-copyright-date
Kim Woodbridge says
Hi Damian – Thanks for the link!