Select Page

Want to add "last updated" date to your Divi blog?

In this article, I'll share you exactly how to add "last updated" date to Divi in just a few clicks.

Here's an important disclaimer.

You Divi users are lucky ...

Being a StudioPress user for over 3 years, it is extremely hard to configure the child theme especially when you are talking about an aged-domain.

Using Divi, you can easily change anything in just a few clicks.

Plus, with the constant updates from the Elegant Themes development team, there is a no brainer that Divi is definitely the best premium WordPress theme.

So, let's get started with "how to add last updated date to Divi blogs."

And if you prefer video tutorial instead, here's a quick 4-minute Divi tutorial video by Divi theme.

How to add 'Last Updated' date to Divi?

There are a few different variations to that you can opt for when adding 'Last Updated' date to Divi.

To be exact, there are four main variations with thousands more inline depending on your needs.


Option 1: Swapping “Publish Date” for “Last Updated”

Add-Last-Updated-Date-To-Divi How to Add “Last Updated” Date to Divi’s Blog Post Meta Data Online Marketing WordPress

What is this snippet code all about?

This method is best when you want to replace the published date to the last updated date. See the image above for more information.

How do you add last updated date to Divi blog post?

The first step is to head over to your WP Admin. After that, navigate your way to Appearance > Editor > functions.php.

It is highly recommended to make a copy of the functions.php file before doing any changes to it. A wrong line of code can crash your entire website.

Paste the following code snippet into your Divi child theme’s functions.php file:

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' ) ) );
$date = $the_modified !== $the_time ? $last_modified : get_post_time( 'M j, Y' );

return $date;
}
}
add_action( 'get_the_date', 'et_last_modified_date_blog' );
add_action( 'get_the_time', 'et_last_modified_date_blog' );

Once this is done, the next step is to click on the 'Update File' button which is found on the page.

Refresh your blog and you will see the new "last updated" date on single posts that you had recently published.


2. Option 2: Adding the Specific Time to Option 1

Divi-Blog-Post-Time-And-Date-Update-Snippet How to Add “Last Updated” Date to Divi’s Blog Post Meta Data Online Marketing WordPress

Divi is one of the best theme for event and news website. 

So, how do you add specific time to an article on Divi theme?

Follow this snippet to add late updated date and time to your 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 \a\t g:iA' ) ) );
$date = $the_modified !== $the_time ? $last_modified : get_post_time( 'M j, Y' );

return $date;
}
}
add_action( 'get_the_date', 'et_last_modified_date_blog' );
add_action( 'get_the_time', 'et_last_modified_date_blog' );

Once this is done, the next step is to click on the 'Update File' button which is found on the page.

Refresh your blog and you will see the new "last updated" date and time published on single posts that you had recently published.


Option 3: Displaying Both the Publish and Last Updated Dates (With Time)

Divi-Blog-Post-Meta-Data How to Add “Last Updated” Date to Divi’s Blog Post Meta Data Online Marketing WordPress

How do you add published date and last updated date with time to Divi blog post meta data?

Just add this snippet to your functions.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 \a\t g:iA' ) ) );
$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' );

Once this is done, the next step is to click on the 'Update File' button which is found on the page.

Refresh your blog and you will see the new "last updated" date and time published on single posts that you had recently published.


Option 4: Displaying Both the Publish and Last Updated Dates (Without Time)

Display-Both-Publish-Date-And-Last-Updated-Date-On-Divi-Theme How to Add “Last Updated” Date to Divi’s Blog Post Meta Data Online Marketing WordPress

To display both the published date and last updated date (without the time) on Divi blog post meta data, you would require this snippet to be placed in your functions.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' );

Once updating the functions.php file, proceed to click on the "Update File" button.

If you want to check if you had done correctly, hit the refresh button on your Divi blog post to check on the final display.


Do you like WordPress tutorials like this one?

As a recap, it is extremely easy to change post meta data using Divi Theme. 

If you’re a Divi designer or developer it’s a great feature to add to your starter child theme so that your theme will look different from the rest!

What other Divi tutorials would you like to see? Let me know in the comments below!