Get the Official WPSaviour App Now!

BlogWordPress Security

How To Show Last Modified Date On Blog Post Instead Of Published Date in WordPress

If you wish to enhance your weblog, probably the greatest issues that you are able to do is replace your outdated posts to maintain them related.

Weblog posts are like wine: the older they get, the higher they turn out to be!

Click on To Tweet

However should you’re following greatest practices and updating your outdated content material, it’s a good suggestion to inform your guests that you just’ve up to date the publish in order that they know the content material remains to be related. That is one thing I’ve been utilizing on WPSaviour for the previous couple of years and it has been actually useful to our readers. In reality, two years in the past, I did a case research on the consequences of displaying dates on the weblog publish and in addition wrote this comply with up weblog publish. You need to learn these two posts as it’s instantly linked to your weblog search engine optimisation and can show you how to entice extra visitors.

Getting again to displaying the final up to date timestamp as a substitute of final revealed:

The issue is, WordPress solely exhibits the date when the publish was final revealed, quite than while you most just lately up to date it, by default.

To repair that concern, I’m going to current a information on easy methods to present the final modified date on a weblog publish as a substitute of the revealed date or the modified date moreover the revealed date.

I’ll present you a couple of completely different strategies utilizing each code and plugins. Whereas every technique is pretty related, there are some variations between them which I’ll level out.

Web page Contents

How To Present Final Modified Date And Revealed Date At The Similar Time

With this technique, you may show the unique revealed date, however robotically add a final modified date as effectively (however provided that you’ve truly modified the publish after publishing).

It is a good strategy as a result of it exhibits the age of your publish, whereas additionally letting readers know that you just’ve just lately up to date it.

To make use of this technique, all it’s essential do is add a code snippet to your WordPress website.

When you can at all times add this code snippet on to the features.php file in your little one theme, I like to recommend utilizing the free Code Snippets plugin as a result of it makes it simpler to maintain observe of issues afterward. It additionally ensures, should you ever swap themes, that your new theme will proceed to show the final modified date.

As soon as you put in and activate Code Snippets, go to Snippets → Add New in your WordPress dashboard.

Then, paste this code snippet into the Code field:

perform show_last_modified_date( $content material ) {
$original_time = get_the_time('U');
$modified_time = get_the_modified_time('U');
if ($modified_time >= $original_time + 86400) {
$updated_time = get_the_modified_time('h:i a');
$updated_day = get_the_modified_time('F jS, Y');
$modified_content .= '<p class="last-modified">This publish was most just lately up to date on '. $updated_day . '</p>';
}
$modified_content .= $content material;
return $modified_content;
}
add_filter( 'the_content', 'show_last_modified_date' );

Choose the field for Solely run on website front-end. Then, click on Save Adjustments and Activate on the backside:

display-last-modified-date-instead-of-publish-date

Right here’s what the code does:

  • Checks to see if the publish’s final modified date is newer than its revealed date.
  • If the final modified date is newer, it shows a message saying that the publish was up to date.

You’ll be able to see an instance of this under:

Example of last modified

If desired, you may modify the textual content that shows earlier than the modified date by modifying the “This publish was most just lately up to date on” textual content within the code snippet.

For those who’re snug with CSS, you can too add your individual CSS styling to make the modified date extra noticeable.

How To Present Final Modified Date On Weblog Submit With A Shortcode

For those who desire to keep away from the necessity to use a code snippet, there’s additionally a free plugin at WordPress.org that makes it straightforward to show the final modified date of your posts through a shortcode.

The draw back of this strategy compared to the previous technique is that it’s important to manually add the shortcode to every publish the place you wish to show the final modified date.

However the profit is that it is vitally straightforward to make use of.

To get began, set up and activate the free Final Modified Timestamp plugin.

Then, add the [last-modified] shortcode to the publish the place you wish to present the final modified date, in addition to an non-obligatory message earlier than or after the date.

For instance, should you enter one thing like this on the backend…

Last modified shortcode example

…it’s going to appear like this on the frontend of your website:

Last modified shortcode example on frontend

How To Present Final Modified Date On All Weblog Posts With A Plugin

For one more code-free possibility, there’s a free plugin referred to as Submit Up to date Date.

In contrast to the Final Modified Timestamp plugin from the earlier part, there aren’t any shortcodes concerned with this plugin.

As a substitute, as quickly as you activate the plugin, it begins functioning.

Right here’s what it seems to be like after you activate the plugin:

Post updated date example

The one potential draw back of this plugin is that it exhibits the final up to date date it doesn’t matter what.

The code snippet that I confirmed you within the first part solely seems should you modify the publish after its publish date. However with this plugin, the final modified date will nonetheless seem even when it’s the identical because the publish date.

You’ll be able to see this within the instance under:

Post updated date example

For that purpose, just remember to’re happy with this performance should you determine to make use of this plugin technique over the code snippet I demonstrated earlier.

How To Substitute Final Revealed Date With Final Modified Date

To this point, all of the strategies that I’ve proven you’ve handled displaying the final modified date of a publish as well as to the unique publish date.

However what if you wish to fully change the publish date with the final modified date?

Effectively, it’s doable, however it’s exhausting to present a tutorial on as a result of it’s important to edit your theme’s template information instantly and each theme handles displaying publish dates somewhat otherwise.

This technique is sweet as a result of it solely exhibits the latest date to search engines like google.

However until you recognize somewhat bit about PHP already, I don’t suggest making an attempt this technique by your self.

Nonetheless wish to proceed?

For those who really feel snug digging into your theme’s template information and have a current backup of your website, discover the road of code the place your theme outputs the publish date and change it with this:

<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "Final up to date on ";
the_modified_time('F jS, Y');
echo ", "; }
else {echo "Posted on "; the_time('F jS, Y');} ?>

This code will present:

  • Posted on…[date] for posts that haven’t been up to date
  • Final up to date on…[date] for posts that you’ve up to date

For instance, right here’s how that appears once I edited the default Twenty Seventeen theme:

Show Last Modified Date

And right here’s the way it seems to be on the frontend of my website:

Show Last Modified Date in blog post

Once more – that is positively a sophisticated technique. Every theme handles publishing dates otherwise, so until you recognize the fundamentals of PHP, you’ll wrestle to implement this to your personal theme by your self.

Which Methodology Ought to You Use On Your Web site?

For many bloggers, I believe the primary technique is one of the best as a result of it’s versatile and in addition pretty straightforward to implement.

If you’d like one thing easier, each the plugins are stable choices, although they aren’t as versatile.

And should you’re snug modifying your theme’s template information instantly, the final technique allows you to solely present a single date, quite than displaying each the final revealed date and the final modified date.

Have you ever tried any of those strategies? Which did you discover to be the best to implement? Let me know within the feedback!

Download The WPSaviour App Now

Related posts
Beginner’s GuideBlogShowcase

7 Best Shopify Alternatives in 2020 (Cheaper and More Powerful)

Beginner’s GuideBest WordPress PluginsBlog

14 Best AI Chatbots Software for Your Website (Comparison)

Beginner’s GuideBlogTips

Magento vs WooCommerce – Which one is Better? (Comparison)

Beginner’s GuideBlogTips

12 Best Calculator Plugins for Your WordPress Site

Sign up for our Newsletter and
stay informed

Leave a Reply

Your email address will not be published.

Fear Of Missing Out?

Sign up with your email address to receive WordPress tips and updates
SUBSCRIBE NOW
Terms and Conditions apply
close-link
Click Me