How to set a dynamic date in WordPress
Ahhh, so you have a WordPress/PHP site, but the footer is displaying your three-year-old copyright date. We’ve done it too. We see the year every time we visit and think, I’ll change that this weekend.
Well, let’s just make sure that happens automatically from now on. Just a little code addition will help that year change for you and set a dynamic date… another little item to mark off the list.
Normally, the footer.php contains the copyright date. So let’s head that direction. Once you’re there, locate the current or outdated year.
Switch that out with the following:
<p>© <?php echo date('Y') ?></p>
Format and style the text as needed. Save and refresh. And that’s how to set a dynamic date in WordPress!
If you’re using a theme or template for a CMS like Joomla! or WordPress and they have a section for footer text, check with the developer to see if that section will accept HTML/PHP. If so, try it out. Most modern themes will.
As always, backup and edit safely.