Would you like to see the last update date of your articles on WordPress?
Some websites update their posts regularly and would like to present to users when the post was updated.
In this tutorial, we will show you how to easily display the date of the last update of your articles on WordPress.
But before, if you have never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog
Then back to why we are here.
When will you need to view the modification date of an item?
Most WordPress themes usually display the date an article was published. This is fine for most blogs and static websites.
Discover How to change the date format on WordPress
However, WordPress is also used by websites where old articles are regularly updated. This last update date is important information for these publications.
The most common example is news websites. They often update old information to add new developments, add corrections or new media files.
See also: How to display relative dates on WordPress
If only the publication date is displayed, then subscribers or visitors will miss these updates.
Many popular blogs and websites do not display any date in their articles. This is a practice not recommended and you should never delete the dates of articles in your blog.
That said, let's see how to easily display the latest update date on your WordPress articles.
How to display the date of update of an article on WordPress
In this tutorial you will be required to add code to your WordPress files. If you haven't done it before then we advise you to consult our guide how to create a WordPress plugin.
1 method: How to display the date before the content
You must add this code to functions.php file in your WordPress plugin:
function bpc_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 = the_modified_time ('F jS, Y'); $ updated_time = the_modified_time (); $ custom_content = ' Updated : '. $ updated_date. 'at'. $ updated_time. ' '; } $ custom_content. = $ content; return $ custom_content; } add_filter ('the_content', 'bpc_last_updated_date');
This code checks if an article's publication date and modification date are different. If so, it displays the last modified date before the post content.
You can add Custom CSS to style to customize the display. Here is a small CSS that you can use as a starting point:
Go further by consulting How to remove the dates of comments on WordPress
.last-updated { font-size: small; Text-transform: uppercase; background-color: #fffdd4; }
2 Method: How to Add the Edit Date of an Article with WordPress Theme Templates
This method requires you to modify specific files of your WordPress theme. Many WordPress themes now use their own template tags that define how these themes display metadata like modification date and time.
See also How to display the date of last connection to a user on WordPress
Some themes also use content templates or template parts to display articles.
Few simple themes will use " single.php "," archive.php , And other template files to display meta content and information.
You will be looking for the code responsible for displaying the date and time. You can then either replace this code with the one below, or add it after the date and time of your WordPress theme code.
$ u_time = get_the_time ('U'); $ u_modified_time = get_the_modified_time ('U'); if ($ u_modified_time> = $ u_time + 86400) { echo " Updated "; the_modified_time ('F jS, Y'); echo "to"; the_modified_time (); echo " ";}
Discover also some premium WordPress plugins
You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.
We offer you here some premium WordPress plugins that will help you do that.
1. WavePlayer
As you might guess from the name, WavePlayer is an audio player plugin that takes the waveform of the played audio file. With this plugin, you will be able to host tracks or simply integrate it with other services.cloud hosting, such as SoundCloud.
It can also be used for podcasting purposes and it offers other features such as: HTML5 support, responsive layout, WooCommerce integration, etc. You will also be able to visually create a playlist before publishing it. Another essential feature is its speed and efficiency.
Download | Demo | Web hosting
2. Out-Of-The-Box
Out-Of-The-Box is another premium WordPress plugin that comes with a built-in Dropbox explorer. It also has an option through which you can provide your visitors with full access to your Dropbox content. It is a very good plugin for community websites.
Notable features of the latter are among others: a complete and full system to allow your visitors to view videos and audio files stored on your Dropbox servers.
Learn as well How to duplicate an article or a page on WordPress
For example, to view the images, users will have an elegant gallery with a fully integrated lightbox that will support Lazy Loading.
Download | Demo | Web hosting
3. WP Media Folder
WP Media Folder lets you explore your media library in the same way you do with your desktop computer. It lets you drag and drop media files into folders and subfolders. Using this media manager, you will be able to manage and sort files and images. The creation of the files, the exploration and the filtering will also be done very quickly.
This WordPress plugin is based on the native media library. Therefore, if you uninstall it, you will not lose any files. Records are generated using a custom taxonomy. Which means that even if you move a file from one folder to another, the links will not be affected. You will be able to sort files by file type, size or title and filter them.
How to use categories and labels effectively on WordPress ? Check out this article and leave us your impressions in the dedicated section.
In addition, you will be able to import entire folders from your server to your media library. An automatic synchronization function will allow you to synchronize any folder on the server with a folder in the media library.
WP Media Folder is compatible with WooCommerce and with any other plugin that uses the WordPress media library. You can also use this plugin to add a watermark to all or some images in the media library. An extension of this plugin will facilitate integration with Google Drive, Dropbox, PDF integration and One Drive.
Download | Demo | Web hosting
Other recommended resources
We also invite you to consult the resources below to go further in the grip and control of your website and blog.
- How to fix the image upload error on WordPress
- How to disable WordPress credits on your themes
- How to display a WordPress link to log out
- How to make money on the internet through your blog?
Conclusion
Here ! That's it for this tutorial. We hope that you will be able to display the modified date of a post on your blog. If you have any questions, please don't hesitate to ask us. feel free to share the tip with your friends on your social networks.
However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.
But in the meantime, tell us about your Comments and suggestions in the dedicated section.
...
Ads in the middle of codes, stupid, we can not copy / paste !!!
Curious way of making a remark.
Hello,
Bad code ... Not functional and full of quotation marks in the code.
Works much better this way and does not create an existing function on wordpress.
To add on the pages at the desired location singles-content or singles or pages or other according to your configuration of themes:
Article updated on at
Publication code problem
can be this way:
Article updated on at
Thank you
Thank you for the remark Guillaume.