Code for the New Year
With the New Year now being here many people will need to update their footer on their sites. Well, that is unless you’ve taken one of my classes 😉
For those of you that have not…
Here is a simple code that you can add to your site so you’ll never have to change the copyright date ever again. There is two ways to handle this first if your webpage does NOT end in .php use this first example.
open up notepad or your favorite text editor then copy the following code into that blank text document.
// Code to display 4 digit year
var mydate=new Date()
var theYear=mydate.getFullYear()
document.write(theYear)
Save that file as year.js and upload via ftp to the root of your website. For most people that will be in your public_html folder in your web hosting account.
Finally open the page you want to include the year copyright on and insert the following code in the exact spot you want the year to appear. NOTE this code assumes that the page you are editing is in the same folder as the javascript file (year.js)
Copyright <script language="Javascript" src="year.js"> <script>
Upload your newly edited page and your code should appear showing the current year and you should never have to update the year again.
NOW, for those of you using .php pages it is MUCH easier.
Simply open up the page you would like to add the year code to and simply add in the spot you would like the year to be displayed and then re upload that page to your website.
I’m looking on updating my web basics class, I would love to hear any comments to see if there is interest in that. For those looking for more than just the basics or a refresher and beyond check out Webpage Secrets Revealed
As always I’d love to hear if this was useful for you so I know whether or not to do more of these type of posts.
Frank, it was so nice to read this post ~ think “OMG did I do this”? Go back and check my website to find out it already showed 2011!
It was a GREAT class & I am very glad I invested in myself and took it as well as doing the homework! I have loved all of your webinars and highly recommend them to others!
Hi Frank,
It’s really a cool tip for every blogger. Thanks alot for sharing this with us and I would like to share this with my other twitter & facebook friends. Can you enable the addtoany plugin so your readers like me can share this valuble tip with others too.. Thank you & take care..
Thanks Carla I’m glad you liked the class and look forward to having you join in the upcoming classes.
Nithiyaah – thanks for the comment – I do have a “share this plugin in place but just added “1-click Retweet/Share/Like” which I think maybe even easier for people to retweet or post to facebook. Thanks for the suggestion.
Ok…still quite a newbie here with code…when you say for .php its much easier just enter the year code…what “year code” are you referring to???