I am looking for a way that I could add some code to my wordpress template to display the time of a post in relative terms. So if, for example, I posted something 5 minutes ago it would say something along the lines of Posted 6 minutes ago or 2 days ago, or 1 week ago. You get the idea. Could anyone give me some guidance on how I could go about doing this?
WordPress actually has an obscure and little known function called
The function will only do minutes, hours, and days, though. If you need to get weeks, for example, you could do something like this:
That would give you
You can also try the
call it like:
I think this is the original source of the code