Update your Blog year automatically

Posted on 01/04/09 in Blogging Tips, Web Design, No Comments

A friend of mine, noticed that many websites and blogs are dated 2008 and we are now in 2009.  Is your blog still in 2008?. If so not to panic, because there are millions more blogs that are.

How to update the blog year automatically?

Now if have a Wordpress blog you can update the year easily, in order to do this we are going to need a little bit of PHP. For those, that don’t know what PHP it is a programming language, however, I am going to supply the code, so don’t worry.

In Wordpress, you will need to edit your theme. Here are the basic steps.

Step One
Locate the theme editor for your existing theme (I am using Wordpress 2.7, so it will be under Design, then select Theme Editor).

Step Two
In the Theme Editor we are going to select footer.php. (The footer.php file is when the information for the footer is in your blog).

Once selected the footer.php file, in the text you will notice some code. Now the code will vary depending on the Wordpress blog. Notice in the image below. I have highlighted the year 2008. We are going to remove the number 2008.

Step Three
We are going to add some PHP into here. Basically we are telling the computer to display date according to the server, the site is located on.

We are going to delete 2008 and copy and paste the code below:

<?php echo date(“Y”);?>

The added code is highlighted in red.

Save your footer.php  file and launch the web page and it will update the page for you. In 2010, 2011 and beyond the blog will automatically update the year for you. So you don’t have to worry about it ever again.

Happy Blogging.

If you have found this tip useful please leave a comment.

Post a Comment

Your email is never published or shared. Required fields are marked *

Back to Top ↑