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

Related Posts

  1. Discount Code for Web Hosting with Dreamhost
  2. OD Add rel=lightbox Plugin for WordPress
  3. Photoshelter Promo / Referral Code
  4. Add rel=prettyPhoto Plugin for WordPress
  5. Interesting Links for December 22nd, 2011

3 Comments »

  • Dave B says:

    If you are unable or unwilling to add Java to your site, but are using PHP (e.g. WordPress), there is another approach that works well. Simply use PHP directives to create the year reference and add a line as follows into your page footer (or wherever):

    Copyright © 2007- All Rights Reserved.

    The Java email link is a cool trick.

  • Dave B says:

    Hmmm…

    Looks like the php code got filtered out.
    Here is a munged version of the php code:

    Copyright [ampersand]copy; 2007-[open_angle]?php echo date(‘Y’);?[close_angle] All Rights Reserved.

    In real life you’d need to substitute what is stated in the square brackets with the named symbol.

    Hope this is clearer!

RSS feed for comments on this post. TrackBack URL


Please comment on this article if you have any questions, conflicts, or great ideas!

PhotoShelter Member Since 2008 - Join & Save!

TheBuckmaker.com Wordpress Themes | Kreditzinsen, Streaming Audio