• 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter thajack

    (@thajack)

    After looking, I believe I had stolen some of the code from Dunstan’s Time Since mod. It is a great mod, I just wanted the output displayed a little differently, hence the mod of the mod.

    Any idea why, though my last post was on the 28th, the last post date says my last post was 4 days ago (which would have made my last post on the 24th?)

    Thread Starter thajack

    (@thajack)

    I don’t know how much help I’ll be. It was the first time I’d ever messed with PHP and all I did was change the output. But… it’s not going to work for “Last Post” type of thing. It needs to be put in the loop (i.e. next to the time of the current post) because it reads the date/time stamp of the current post.

    Does that make sense?

    I’m sure it can be modified pretty easily to do what I think you’re doing, but the way it is currently, it needs to be right there with a post title.

    You can look at my page for an example of where I placed it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Updated Time Since’ is closed to new replies.