Do you regularly update your articles? Do you want to show the last updated date on your WordPress posts & pages? Here is the solution.

Many of the readers ask me about the common problem they are facing. The problem is that the most of the WordPress posts and pages bear the published date but not the WordPress last updated date. Many of such websites use the WordPress that regularly updates the old articles. For them, WordPress last updated date is an important information. But unfortunately, WordPress themes bear only the last published date.

Secondly, Google searches also regard a 2-year old published date with suspicion. To go around this problem, one needs to update the content regularly and the last updated date too.

But WordPress won’t display that the content has been updated by default. So, here at Templatetoaster WordPress theme builder, this article will show that how to deal with the problem of WordPress last updated date.

 

How to implement WordPress “modified_date”?

To add WordPress “modified_date” you don’t have to do much. You just have to replace some code with the code snippet given below. For example, if you are working on Twenty-Seventeen theme of WordPress;

  • Just go to Theme Folder within WordPress Installation folder.
  • Move to Template-tags.php file and locate the twentyseventeen_time_link function.
  • Find the old code.
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}

$time_string = sprintf( $time_string,
get_the_date( DATE_W3C ),
get_the_date(),
get_the_modified_date( DATE_W3C ),
get_the_modified_date()
);

return sprintf(__( '<span class="screen-reader-text">Posted on</span> %s', 'twentyseventeen' ),
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
);

Replace this code with the new code given below

if ( get_the_time() !== get_the_modified_time() )
{
$time_string = '<time class="entry-date up_post published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
$post_status='Updated on ';
}
else
{
$time_string='<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated pubpost" datetime="%3$s">%4$s</time>';
$post_status='Posted on ';

}
$time_string = sprintf( $time_string,
get_the_date( 'c' ),
get_the_date(),
get_the_modified_date( 'c' ),
get_the_modified_date()
);
return sprintf(__( '<span class="screen-reader-text">%s</span><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">%s</a>', 'Templatetoaster' ),$post_status,$time_string );

You are done. Now you can see the last updated date on your post.

 

Final Thoughts

Displaying the WordPress last updated date can have a great impact on your site. You just have to paste the little snippet for this. The viewers will believe more in updated content. This will pay you a lot in terms of better rankings, more views, and more user engagement. You do lots of things to improve the conversion rate, decrease the bounce rate and time-spent by users on your sites. These efforts just serve as a bonanza with a beautifully-crafted site. So, to create an amazing website, get your hands on TemplateToaster, a website builder software and WordPress website builder software that can generate a theme in less time with advanced tools magically. Check out our free WordPress themes.