Dates are a prominent component of WordPress. Whether you are using this software to create a blog or build a more traditional website, it’s likely they will be featured in some way, throughout your project.
Many of us are now hooked on tracking down and consuming the latest content in order to stay up to date on the topics that we are most interested in. This means it’s vital that your website recognizes this growing trend and is configured accordingly.
Seemingly out of the date content can easily repel your target audience, especially those who are looking for up to date information; while providing your visitors with the latest information regarding upcoming events can become a useful feature of your website.
In this article we will take a look at a few of the different ways you can work with dates and times in WordPress. From ensuring your visitors can tell that your content is up to date, through to listing forthcoming events, displaying a timer counting down to the big day, and even retiring old content automatically, there are plenty of different ways you can use time and dates to your advantage.
So without further ado, here are some different ways you can work with dates and times on your WordPress website.
Display the Date Each Post Was Lasted Updated
If you’re in the practice of updating the content of your blog posts on a regular basis, then there are a few reasons why you should consider displaying the date each post was last updated, rather than the date it was first published.
Using the default WordPress configuration of displaying the published date could be costing you visitors and negatively affecting the bounce rate of your website.
If your visitors are looking for the latest and most up to date content, and your posts are still displaying their original publication date instead of the date that content was last updated, then those visitors may well be hitting the back button as soon as they arrive at your site.
Furthermore, search engines such as Google, often prioritize new content over old in their results pages. Therefore, publishing the date your content was last updated, can help with the SEO rating of your website, and increase its chances of ranking more prominently in the search engines.
Not only that, but as search engines also display this date in their results pages, any potential visitors hunting for fresh content might skip over your listing. If you are displaying the original publication date, your potential visitors have no way of knowing that the content has been recently updated. This means that even if your posts and pages are ranked highly in the search engines, you still might not be receiving all the visitors you could.
Thankfully there are a few different ways to overcome this issue, including modifying your theme files, or installing a free plugin. So if this sounds like something you’d like to implement on your WordPress website, we will now take a look at some of the options available to you if you want to start displaying the date your posts were last updated, rather than their original date of publication.
Editing Your Theme Files to Display the Updated Publication Date
This method will update your WordPress theme to display the date of the last time you hit the Update button on a post. This means your visitors will see a publication date that corresponds with the last time that content was updated – rather than the date it was first published.
It’s important to point out that this modification can be achieved differently, depending on your chosen WordPress theme. For this example, we will be using the popular Divi theme.
Before making these changes to the theme files, a post that was updated would still display its original date of publication to your visitors.
However, after modifying the theme files, the date the post was last updated is displayed as the publication date.
If you’d like your website to display publication dates in this way, it only involves editing one line of code. Before you get started, it’s highly recommended that you create a child theme. This will prevent any changes you make being overwritten when you next update your theme.
The file we are going to be editing is the functions.php file. This file is located in the root directory of your theme. To make changes to this file, you have a few options for doing so. You can download the file from your server using an FTP client, make those changes in an app like Notepad++, and then re-upload it to the server.
Alternatively, you can edit the file directly from within your WordPress admin area. This option is quicker, but more risky. If you make a mistake, you could break your website and even lock yourself out of it.
Whichever ever option you choose, be sure to make a backup copy of the functions.php file we are about to edit.
If you do want to edit the file from within your WordPress admin area, first login to your dashboard area, and navigate to the Theme Editor. This can be found under the Appearance menu.
Then, from the list of files on the right-hand side, click on the Theme Functions (functions.php) item.
That file should now be open in the main editor window, as indicated by the title text. Now hit the Ctrl + F keys to open the browser find tool, and look for the line that contains this code:
$postinfo_meta .= get_the_time( wp_unslash( $date_format ) );
Then change the line to the following:
$postinfo_meta .= get_the_modified_date( wp_unslash( $date_format ) );
After you’ve done that, hit the Update File button at the bottom of the screen. Now try updating a post, and then viewing it from the front end of your website. The date the post was saved should now be displayed as the post date. This also extends to the blog post archive page.
As mentioned, this example works with the Divi theme. If you are using a different theme, please contact the supplier for instructions on how to enable this effect on your website.
Using a Plugin to Display the Post Last Modified Date
If you don’t want to edit the files of your WordPress theme, another option is to install a plugin that will enable you to display the date each post was last updated. By going down the plugin route, this last updated information will be displayed in addition to the original date of publication.
If this option appeals, then the plugin to install is the free WP Last Modified plugin. After activating this plugin on your WordPress website, the date the post or page was last updated is then displayed in your content.
Through the plugin settings you can choose the position of the time stamp, as well as selecting a date format. You can also add some text to accompany the date, such as last updated on, for example.
Now, depending on your chosen settings, the date of the last updated will be displayed to your visitors when they reach your site.
If your content isn’t time sensitive at all, you could go one step further and consider removing the publication date from your posts altogether.
Removing the Date of Publication from Posts and Pages
If you are using an Elegant Themes product, such as the Divi theme, then you can quickly stop displaying the publication date on your posts by disabling this option on the ePanel.
To do so, simply login to your WordPress admin area and navigate to Appearance > Theme Options screen. Then click on the Layout Settings of the ePanel. From the Single Post Layout tab, click on the Date icon to disable it. Be sure to click on the Save button to apply your changes.
This will then prevent your theme from displaying the published date on your website, when a visitor is viewing a single post.
However, the post date is still displayed on your website when the posts are listed, such as on the blog post archive page.
If you want to rectify this, return to the ePanel, and switch to the General Settings tab. Then click on the Date icon until it is greyed out. Then hit the Save button to apply your changes.
Now when your visitors browse the post list pages, they will no longer see the date of publication.
If you aren’t using a theme with a control panel that makes it easy to hide the post date, then the free WP Date Remover plugin might be able to help you achieve this. Testing this plugin produced mixed results, with it working on some themes, but not on others. Therefore, it might work for your chosen theme, or it might not.
Only Display Publication Date on Recently Published Posts
If you only want to display the date of publication on your most recent posts, then the free WP Old Post Date Remover plugin might be a better option. This plugin allows you to enter a cutoff point, after which point, any posts older than a certain date won’t display when they were published.
Again, when tested this plugin produced mixed results. It worked well on some themes, while not on others, including not working with the Divi theme. Although if you post the details of your specific theme in the plugin support forum, the developer seems willing to help others find a solution.
Quickly Set the Publication Date to the Current Time and Date
Another free plugin you might find useful if you are regularly updating your content, is the Date/Time Now Button plugin. This tool adds a new button to the post editor screen, which when clicked, changes the publish date of the post to the current time and date.
Clicking on the edit button that is located under the current publication time and date, reveals the discrete now button. Once you’ve updated the post with the new post date, this information will be published on the front end of your website.
Your visitors will now assume this is the original publication date of your post. This then helps to make your content more appealing to anyone who is looking for up to date information. Using the Date/Time Now Button plugin is a nice alternative to modifying your theme to display the last updated date for each post.
If you want to display your most recently updated posts in the sidebar of your website, this free plugin and its widget can help you achieve this with ease.
Creating Timed Content with an Expiry Date
Another interesting way you can work with dates and times in WordPress, is to create scheduled or timed content. Typically this content is only available for set periods of time, before it’s automatically archived and no longer available to your visitors.
Some examples of uses for this could include limited offers, where you provide a discount on your products or services for a set period of time. Or maybe your blog includes predictions, forecasts, or announcements relating to future events. As this content is no longer needed after the event has occurred, managing the visibility of the post or page with a scheduling tool can automatically remove it from your site.
Whatever your reasons, whether you want to restrict access to an entire post, or just a portion of it, there are two free plugins that can help you easily achieve this. We will now take a look at two of the options that are available, in order to demonstrate how you can create content on your blog that automatically expires after a set time and date.
Post Expirator is a free plugin that gives you the ability to set your posts and pages for automatic expiration on a certain time and date. Once the plugin has been activated on your site, a new control box is added to the WordPress post and page editor screens. From this control box, you can enable post expiration, and then set the time and date of expiry.
When creating an expiration date, you can choose how the post expires. These options include changing the post status to draft, private, or simply deleting the post and moving it to the trash. Alternatively, you can change the category of the post upon expiration.
If a visitor tries to access an expired post, for example by following an old link, they will be presented with a page not found 404 error. If you haven’t done so already, now would be a good time to create a custom 404 error page for your WordPress website. This can then help you to avoid confusing any new visitors attempting to reach an expired page.
Through the plugin settings page you can set a default expiration for all new posts. You also get the option of automatically inserting the time and date of expiration into the post content. This gives your visitors a warning that the post or page they are viewing will no longer be available past a certain point in time.
If you want to expire portions of a post or page, rather than the entire article, then the free Scheduled Content plugin might be a better option for you. With this plugin installed on your website, you can place the content you want to control inside the shortcode.
The shortcode parameters give you the ability to hide and display the content, according to your preferences. This allows you to display the content until a certain time and date, or reveal it after a set point in time.
The Post Expirator and Scheduled Content plugins can be used together on the same website. This gives you plenty of options for how you automatically control the visibility of your content.
Display a Countdown Timer
If you’re launching a product or service, or hosting an event, then adding a countdown timer to your WordPress website is something you might like to consider.
The free WordPress Countdown plugin and its premium alternative, is a tool that gives you an easy way to display countdown timers on your website. The plugin includes a handy post editor button for adding timers to your content, as well as a widget for displaying them in your sidebar areas.
While the above free countdown timer doesn’t feature the most attractive design, it is very easy to set up. Upgrading to the $13 premium option gives you access to a much bigger selection of countdown timer designs.
If you want to build anticipation in the lead up to an important date, then adding a countdown timer to your blog is a great way to do so.
Displaying a List of Event Dates
Displaying a list of upcoming events is another way you might want to work with dates on your WordPress website. If you want to display any kind of list of dates on your site, this can be a handy tool to make use of.
One option for achieving this is to use the free Upcoming Events Lists plugin. This plugin adds a new Event post type to your website, allowing you to enter the details of each event. Each event can have a start and end date, as well as a location. You can also give each event a title, a description, and a featured image.
The published events can be accessed individually by your visitors. You can also display a set number of events in the sidebar of your website. This can be achieved by using the included Events widget.
Another similar plugin, is the Very Simple Event List plugin. This option works in a similar way, except that it includes a shortcode for displaying all the events on your website, in a single post.
By choosing one of these plugins, your visitors can now quickly see your forthcoming events in either the sidebar, or a dedicated post or page on your website.
As you can see there are some interesting ways you can display dates and date related content on your WordPress website.
Changing your website to display the date when your post was actually last updated, rather than when it was first published, can really help improve the shelf life of your content. Whether you are publishing guides, tutorials, reviews, or other timely content, making it easy for your visitors to see when that information was last refreshed is something that is easy to implement and can deliver some quick wins.
While the other time and date features, such as expiring content and countdown timers, might be better suited to more niche projects, I hope this article has encouraged you to think how you can work with dates and time differently on your website.
What are some of the other ways you’d like to work with dates and times on your website? Have you made any interesting changes to the way your website handles this type of data? How important is it that the content you are looking for is up to date? Please share your thoughts in the comments below.
Article thumbnail image by Jane Kelly / shutterstock.com