Customize Time Stamp

Question

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(); ?>

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/customize-time-stamp/">

Customize Time Stamp</a>
0
, , rlm 2 months 0 Answers 68 views 0

Leave an answer