This site uses affiliate links - that means I will receive a small commission to help run this site, all at no cost to you! 

Though some bloggers seem to be moving away from dating their posts to supposedly keep content “evergreen”, I’m not one of them and I’m not sure it works that well.

Rather, I have added a handy little piece of code to my Divi website that shows not only the date of the original post, but also the date that the post was last updated! I find this to be a better option for my blogs.  This is based on this post from Elegant Themes explaining a couple different options for adding the “last updated” date.

The code below goes in your functions.php file in your child theme. 

Don’t edit the Divi theme itself.  A child theme is always the way to go for customizations that stick around after you’ve updated the core Divi files!

Go to the bottom of the functions.php file under Appearance >> Theme Editor, paste in the code below and click Save.

[php]
function et_last_modified_date_blog( $the_date ) {
    if ( 'post' === get_post_type() ) {
        $the_time = get_post_time( 'His' );
        $the_modified = get_post_modified_time( 'His' );
 
        $last_modified =  sprintf( __( 'Last updated %s', 'Divi' ), esc_html( get_post_modified_time( 'M j, Y' ) ) );
        $published =  sprintf( __( 'Published on %s', 'Divi' ), esc_html( get_post_time( 'M j, Y' ) ) );
 
        $date = $the_modified !== $the_time ? $last_modified . ' | ' .  $published : $published;
 
        return $date;
    }
}
add_action( 'get_the_date', 'et_last_modified_date_blog' );
add_action( 'get_the_time', 'et_last_modified_date_blog' );
[/php]

Pin It on Pinterest

Share This
%d bloggers like this: