Dynamic Copyright Year Using PHP or Javascript

Dynamic Copyright Year

Wish you never had to update a footer widget to change the copyright year ever again?  You need to implement a dynamic copyright year into your site.

Here are a couple ways to automate this needless yearly task.

If you have control over the theme, here is the PHP code that will automatically spit out the current year.

&copy; <?php echo date('Y');?>


Or, if you can’t or don’t want to touch the footer.php file, here is a javascript alternative.  You should even be able to use this in a custom HTML or text widget.

&copy; <script>document.write(new Date().getFullYear());</script>


Notify of

Inline Feedbacks
View all comments