People Want the Latest Info
A very useful feature to have for your blog is to show both the Published Date and the Last Updated Date in each post. This can tell the reader how up-to-date the information is.
I feel being able to see Last Updated Date will become more important as time goes on and people seeking only to consume the most up-to-date information. They will often choose to read only the most recent article. So having both of the dates is an inexpensive way to keep your blog 'new'.
Simple Project
Luckily Divi Theme provides this great article on how to add various formats to your fuction.php file. You can find this file in your Child Theme's folder.
Copy My Code
For those that are not comfortable putting together their own code combination from the article you can just take my code. This code below will get you both the Published Date and the Last Updated Date.
//Adding 'last updated date' & 'published date' to blog post
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' );
//end "last udpated date" & 'published date' for blog post
Powered by StoryChief