Code Snippets

How to Convert Date to Time ago WordPress

This Snippet is supposed to add in single.php, index.php or any other template within the loop. Don’t you think it would be finest thing to display on post where you can show post like “1 hour ago, 2 hour ago, 1 day ago” etc.

echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago';

via Codex , Thumbnail image via inspirationde


21 year old designer, blogger and front-end developer. love to share creative design and inspiration.

Write A Comment