Customize Time Stamp


I’m using this nifty timestamp function that makes the post date “1 day ago” and “five minutes ago” etc. However after a few days I want it to switch to the actual date it was written so for example: January 4th, 2020 at 4:02pm” or maybe just the option to add the time.

Here is the code that does x days ago:

function meks_time_ago() {
    return human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ) ).' '.__( 'ago' );

<?php echo meks_time_ago(); ?>
, , rlm 4 years 2020-03-27T12:51:21-05:00 0 Answers 111 views 0

Leave an answer