- Web templates
- E-commerce Templates
- CMS & Blog Templates
- Facebook Templates
- Website Builders
How to display the last updated date of your posts in WordPress
February 21, 2018
Are you running a blog on WordPress? You may have a news agency and publish some news on your website, or publish any other kind of posts – in any case, it’s a high time to make your website a bit more convenient for the visitors. This can be easily done by changing the way of your posts display and we’re glad to share some useful tips for this.
Today, we’re going to show you how to display the last updated date of your post instead of the default (published) date.

-
In order to add the ‘last modified’ date to the posts, you’ll need to edit theme files. That’s why, on the first step, you should open you FTP or hosting cPanel File Manager tool.
-
Next, navigate to your theme folder, located in the wp-content/themes directory. In this example, we are using the TinyFit theme, so we will enter the wp-content/themes/tinyfit folder.
-
Look for the functions.php file inside and open it for editing with any text/code editor. The recommended ones are Notepad++, Sublime.
-
Then, scroll down to the very bottom of the file and paste the following code to the end:
function my_last_updated_date( $content ) { $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 .= '
'; } $custom_content .= $content; return $custom_content; } add_filter( 'the_content', 'my_last_updated_date' ); -
Finally, save your edits in the file and check the website. The last updated date will appear right above the content of the post!
We hope this step-by-step guidance was useful for you. Feel free to check our blog to learn more tweaks on how to manage your WordPress website as a guru of the web design!
We would also recommend you to view different WordPress themes in case you need a wider choice of website building solutions.