Other NewsHome

पुराने News Article को Update करके Website Traffic बढ़ाये Update Your Old Post With Modified Date🔥

How to Show Old Post Updated/Modified Date in WordPress Without Plugins

In this article you will learn that how to show old post updated/modified date in WordPress without using any plugins and I will show you how can you do that with the help of some short code.

PHP code to show updated/modified date in WordPress

 

// By Talkaaj
add_filter( ‘generate_post_date_output’, function( $output, $time_string ) {
$time_string = ‘<time class=”entry-date published” datetime=”%1$s” itemprop=”datePublished”>Published on: %2$s</time>’;

if ( get_the_date() !== get_the_modified_date() ) {
$time_string = ‘<time class=”entry-date updated-date” datetime=”%3$s” itemprop=”dateModified”>Last Updated on: %4$s</time>’;
}

$time_string = sprintf( $time_string,
esc_attr( get_the_date( ‘c’ ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( ‘c’ ) ),
esc_html( get_the_modified_date() )
);

return sprintf( ‘<span class=”posted-on”>%s</span> ‘,
$time_string
);
}, 10, 2 );

 

Now learn how to show old post updated/modified date in WordPress without using any plugins step by step guide-

  • Login to your WordPress website.
  • Copy above PHP code.
  • Now go to Appearance > Theme file editor > Functions.php
  • And paste the copied code in the bottom of functions.php.

Conclusion

I hope you will learn that how to show modified date in the old post when you update and if you feel that this article help you a lot then follow us on YouTube and also join our telegram for more update.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button