Here’s a little hint for the WordPress users that smacked me square between the eyes yesterday in one of those “a-hah!” moments while dinking with the theme files for my site.
A lot of people will tuck an “All content © 2003-2011 So-and-so” or similar notice in the footer of their site. If you’re one of those who do, and you’re bugged by the fact that you have to change (or forget to change) the latter year every time a new year rolls around, there’s a quick and simple solution for you.
It dawned on me, since WordPress themes are based on the PHP language (this works with any PHP based template system really), why not just tuck the date function into my template footer in place of the latter year? That way it will automatically change when it’s supposed to, and I won’t have to remember anything. So, in place of the following:
<p>All content © 2004-2011 jimmitchell.org</p>
I simply did this:
<p>All content © 2004-<?php echo date("Y") ?> jimmitchell.org</p>
Yippie! No more having to remember to change the footer on January 1st.
Overly simple? Yes. Painfully obvious? Only to those further along the path to web development enlightenment than myself. To the other neophytes like me, it’s one of those moments where we start to wonder “If I can do that, could I do this?” I hope this helps to bring one of those moments to your own work, be it for fun or profit.





Recent Comments