Apr
14
2010

Automatically Update Site Copyright Notice

Copyright 2010I recently realized that I had forgotten to change the copyright notice on some of my websites. I had changed it on all of my still and video cameras and in the metadata fields for Breeze Downloader Pro and Adobe Lightroom; I had even changed it on some of my websites. But somehow I missed a couple.

Instead of just fixing it now for the sites that I missed in January, I wrote some Javascript code to do it automatically based on the year. You can see the resulting text in the Copyright Notice for this site at the bottom of the right sidebar.

Here’s what the code looks like. Note that it automatically updates the year and it links to your email address from your name (in a method very unfriendly to spam harvesters). If you want to use it simply copy and paste into a widget or into your wordpress header or footer and it will start displaying.

NOTE – You must to update the 3 “var” fields to ensure that the code uses your own Name and Email address.

All content on this site:<br>
<script language="Javascript">
var name = "Test User"
var account = "user"
var domain = "testsite.com"
var mydate = new Date()
var year = mydate.getFullYear()
document.write("©" + year + ", <a class=link href='mailto:" + account + "@" + domain + "'>" + name + "</a>")
</script>
<br>All Rights Reserved

If you want to use this code in a post or a page then it will be much more difficult to make it work. You will have to refer to the WordPress Codex for information on how to use Javascript in a post or a page.

Theme Forest - Your choice for Site Templates and Themes

PhotoShelter Member Since 2008 - Join & Save!

TheBuckmaker.com Wordpress Themes | Kreditzinsen, Streaming Audio