WordPress Wednesday: How to Display the Age of Your Site

Wednesday February 25, 2009

WordPressIf you scroll to the bottom of this page, you’ll see that in my footer I display how long I’ve been publishing this site. It’s pretty simple to do this; all you really need is the DateDiff plugin and PHP’s default date() function.


Once you’ve installed DateDiff, just add this code to your footer.php template:

This blog has been online for <?php datediff("2000-3-14","now","y"); ?> years, <?php datediff("2000-3-14","now","ym"); ?> months, and <?php datediff("2000-3-14","now","md"); ?> days.
I have now been blogging here for <? datediff("2000-3-14", date("Y-m-d"), "d"); ?> days.

In case it’s not obvious, you’ll need to replace the “2000-3-14″ with the actual date that you started blogging.

Every Wednesday I do my best to provide a helpful WordPress tip.
Subscribe to my feed to stay updated!

Stay In The Loop:

Subscribe via RSS or Email to receive notifications when new posts are published.

Or just follow me on Twitter!

Leave a Comment

Previous post:

Next post: