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