Thursday, June 1, 2023
HomeBusinessShow the Final Replace Date & Time in WordPress

Show the Final Replace Date & Time in WordPress

Maintain it present

In case you have a web site with posts which are steadily up to date, then it behooves you to let your guests know the articles they’re studying are present. By default, WordPress simply shows the date and time when the publish was created.

Nevertheless, you can also make a dozen updates to an article, it is going to nonetheless solely present the unique date and time.

Some websites supply content material  their readers revisit, and every so often and it makes them really feel heat and fuzzy in the event that they see your content material is present. In case you have up to date a publish just lately, and solely the unique publish date and time is displayed, you may lose guests as a result of they suppose a publish is outdated and outdated.

Nobody needs to lose guests for one thing so foolish, proper?

That sounds groovy. However how do I accomplish this?

I’m glad you requested. This process requires a bit of coding, however nothing too scary. As of writing this text, there are not any plugins obtainable to do that for you, so that you’ll should roll up your sleeves and do a really small quantity of coding.

Don’t fear although, I’ll present you the methods of the power.

show the final up to date date & time in WordPress

Very first thing’s first… earlier than enhancing code, at all times again up your web site first! Get into this behavior now, much less ye be in for it later. Additionally, be certain you’re enhancing your baby theme, not the dad or mum theme.

Now, with that out of the best way, what you’ll need to do is you’ll need to hook up with your web site by way of File Supervisor or FTP. Both works tremendous.

Subsequent, it would be best to navigate to the features.php file. That is positioned in your theme. Navigate to public_html > wp-content > themes > twentytwentytwo > features.php. Now open this file.

*Notice: I simply occur to be utilizing twentytwentytwo. Your theme will doubtless differ.

Scroll right down to the final line within the features.php file and hit a tough return. Now enter this code on the brand new line:

// Final Up to date Date and Time

perform last_date_updated( $content material ) {

$u_time = get_the_time('U'); 

$u_modified_time = get_the_modified_time('U'); 

if ($u_modified_time >= $u_time + 86400) { 

$updated_date = get_the_modified_time('F jS, Y');

$updated_time = get_the_modified_time('h:i a'); 

$custom_content .= '<p class="last-updated">Not too long ago up to date on '. $updated_date . ' at '. $updated_time .'</p>'; 


 $custom_content .= $content material;

 return $custom_content;


add_filter( 'the_content', 'last_date_updated' );

Subsequently, you may also type your new code by going to Look > Customise. Then choose Extra CSS. When you’ve entered your customized type, remember to choose the Publish button, on the high.

Enter on this type and modify it as you see match:

.last-updated {

font-size: small;

coloration: #ff0000;

text-transform: uppercase;

background-color: #ffff00;


Right here is an instance of what it may seem like for you:

Now each time you replace a publish, it will likely be mirrored on the entrance of the positioning. Once more, modify the type declaration as you see match, to higher match your theme’s type.

Closing ideas

It’s at all times a good suggestion to maintain your content material contemporary, as it is going to hold  guests coming again, figuring out they’re getting the newest content material. There are, in fact, many various methods you possibly can edit the code above. That is however one instance.

Now go on the market and have enjoyable! See you subsequent time.



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments