This code creates a custom shortcode which you can use to display how long ago a post was published. For example, this screenshot shows the post was published 2 days ago.
The code displays the amount of seconds, minutes, hours, days, weeks, months or years ago the post was published.
Shows how long ago standard posts and featured posts where published in Genesis child themes.
Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme.
There’s 2 steps :
- # Copy & paste the 2 PHP code snippets ( excluding the opening PHP tag ) from the functions.php file to the end of your child themes functions file.
- # Optional : Add the shortcode named [post_time_ago] to the Genesis Featured Posts widgets > Show Post Info field if you want to add how long ago a featured post was published.