Updated Time Since
-
I have made a modification to someone’s wonderful Time Since hack, though I can’t remember whose it was the first time. I’m very sorry if the credit belongs to you and I have forgotten you. I have modified the way that the output is presented. This is my first hackjob, and it’s also the first php I’ve ever done at all.
It now displays a more “relevant” time since. For instance, commas are now used to separate the parts of the output, it now knows the difference between singular and plural and zero elements are not displayed.
i.e.
Posted 29 seconds ago.
Posted 1 minute, 15 seconds ago.
Posted 1 hour ago.
Posted 1 hour, 10 minutes ago.
Posted 2 days ago.
Posted 2 days, 3 hours ago.
Posted 3 weeks, 2 days ago.
Posted 2 months, 3 weeks ago.
Posted 1 year, 2 months ago.
Just put the function into your my-hacks.php file and call it. Not much documentation included, but I’m sure you can figure out how it works. Just call it from within the loop.
Visit my blog and download it here.
- The topic ‘Updated Time Since’ is closed to new replies.