0

I am unable to find this coding on internet tuturial and highly appreciate for this answer with details.

I want to show latest post on home page like this

1st Post title - posted 4 minutes ago 2nd post title - posted 2 days ago 3rd post title - posted 1 year ago

  • There are tons of code you can find here. Have you performed a search? – Christine Cooper Oct 1 '17 at 17:05
1

In the main loop in index, to display the date like you are asking use:

<?php printf( _x( '%s ago', '%s = human-readable time difference', 'your-text-domain' ), human_time_diff( get_comment_time( 'U' ), current_time( 'timestamp' ) ) ); ?>

You can read more about it: https://codex.wordpress.org/Function_Reference/human_time_diff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.