PHP date "N days ago"

Posted in: ionMag
Post count: 3

Hello! How can I change the default date format (m.d.y) to a new “n days ago” or “yesterday” style? I found a good piece of code, especially for WordPress, but what file from theme directory I need to choose for edititng? Thanks.

Simion C.
Post count: 290

Hi,

I believe you are referring to something like this
https://codex.wordpress.org/Function_Reference/human_time_diff
This will require you to modify the post template used (default post template->loop-single.php or post template 1->loop-single-1.php) liek this
https://www.screencast.com/t/6Sl4Z0Sz
https://www.screencast.com/t/ZYfceMLFG
This is the result – https://www.screencast.com/t/6iADq4n9

Thanks

Post count: 3

Yeah, thanks. It works!

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.