How to Display Today’s Date in WordPress with or Without a Plugin

You are currently viewing How to Display Today’s Date in WordPress with or Without a Plugin

Do you want to show today’s date on your WordPress website?

If you’re maintaining a dynamic news website or a personal blog, you may want to display today’s date on some sections of your website.

This tutorial will teach you how to show today’s date and current time on your WordPress website.

Why Displaying Today’s Date

There are many reasons to display today’s date, and here are the main ones:

  • Your visitors will know that your website is being maintained daily. So you’re showing that it’s up-to-date with the latest trends.
  • Confirm that visitors view the latest updates and not an outdated cached version.
  • If you’re using a chat box plugin on specific hours to provide customer support, it’s vital to show the local time of your location. That will indicate to the customers what time they can reach you.
  • When using a countdown timer to run a time-sensitive campaign, show today’s date to create scarcity and increase conversion.
  • To show hours of operation of auctions and stock websites.
Show todays date on news websites

Now that we understand when is a good time to display the date, let’s move on to the next section and learn how to do it.

Show Today’s Date in WordPress with a Plugin

The easiest way to show today’s date is by using a plugin. There are WordPress plugins for everything, and indeed, one to show the date.

From the WordPress dashboard, navigate to Plugins -> Add New and install the WP Date and Time Shortcode plugin.

WP Date and Time WordPress Plugin

Once activated, you can start using the plugin with one of its many shortcodes.

For example, to show today’s date, enter the [wpdts-date] shortcode in a Gutenberg shortcode block for your desired page or post and click update.

WP Date and Time Plugin Shortcode

Then, visit the page to ensure you like the formatted date.

Date is displayed with a plugin shortcode

If you want to display the date differently than the existing format, navigate to the Settings -> General page and select your desired format under the Date Format section.

Choose a date format in WordPress

Make sure to verify the new format once you save the changes.

Additional Shortcode Parameters

The shortcode above will display the current date with day, month, and year.

However, the plugin comes with many other options and parameters that you can add to the shortcode to customize the displayed date.

Here are some of the most popular shortcodes of the WP Date and Time plugin:

  • [wpdts] – the main shortcode which works with all attributes
  • [wpdts-date-time] – default date and time format from WordPress general settings
  • [wpdts-time] – default time format from WordPress general settings
  • [wpdts-custom]– custom format using the PHP date and time formatting characters
  • [wpdts-years], [wpdts-year] – 4-digit year e.g. 1999 or 2134
  • [wpdts-year-short] – 2-digit year e.g. 99 or 34
  • [wpdts-months], [wpdts-month] – month as a number (1-12)

You can view the complete list on the plugin’s official developer website.

Show Today’s Date without a Plugin

A plugin is not the only way to display today’s date on your WordPress website. You can do it by using a specific theme with a built-in feature or a PHP function.

Use a News Theme

Because showing the current date and time is an integral part of news websites, many developers built this feature in their news theme.

Here are popular WordPress news themes that include the option to show today’s date:

  • EasyMag
  • Jnews
  • Newsmag
  • AquaMag
  • News Pro
  • eNews
  • Amzola

Enabling today’s date feature is a straightforward and similar process for all of them; you’ll need to find the correct settings on the Customize screen.

Let’s take the EasyMag theme as an example. Once you open the customize screen, navigate to Header -> Header Topbar.

The show today’s date option is hidden by default. Therefore, uncheck the Hide Header Date box to enable it. Once unchecked, the date will be added to the top header bar next to the weather information.

Uncheck the hide header date in theme

You can also add today’s date with a PHP function if your website is already established with a theme that doesn’t include that feature.

Display Today’s Date with a Function

A PHP function is another simple method to add today’s date to your WordPress website.

It is beneficial when developing core files, editing the footer or header, or creating custom plugins or templates.

You can place the PHP code in the correct position of your desired template file. Then, you can access your theme’s files using FTP software or the native WordPress Theme File Editor screen.

Tip: please back up your website before editing core files.

If, for example, you’d like to add today’s date to your website’s header, open the header.php file of your child theme, and place the code below in your desired position:

<?php echo date(get_option('date_format')); ?>
PHP function to display todays date

Once saved, visit your website and ensure the date is displayed correctly. To fit your website better, you can also change the date format through the Settings -> General screen.

If you would like to use the PHP code in the frontend and display the date with a shortcode, paste the function below at the bottom of your functions.php file:

// display today's date with a function
function p4wp_show_todays_date_shortcode() {
return date(get_option('date_format'));
}
add_shortcode('todaydate', 'p4wp_show_todays_date_shortcode');

Once saved, use the [todaydate] shortcode with your favorite page builder plugin, Gutenberg blocks, or the classic editor.

Custom shortcode display date

The few methods explored above will require you to add a custom plugin or a code to your WordPress website to display today’s date.

However, if you’re already using a page builder plugin, such as Elementor, you can show the date directly with the plugin and skip the extra steps.

Show Today’s Date with Elementor

Elementor, a popular page builder plugin, simplifies the process by allowing us to display today’s page on any section of our website.

The advantage of using Elementor is that you don’t need to install any additional plugins or custom functions.

Instead, you can easily display today’s date with the dynamic content feature of Elementor Pro.

You can get Elementor Pro from the official website for a total price of $49, or from us, for only $4.99.

Once you have activated Elementor Pro on your website, click on the Edit with Elementor button to open the visual editor screen of your desired page or theme builder section.

Then, drag the text editor or the title widget from the left sidebar to the canvas on the right.

The widgets will be filled with placeholder content that we need to replace with the current date. To do that, click on the dynamic tag icon and select the Current Date Time option under the Site section.

Elementor current date time dynamic tag

The widget will default display your location’s date and time. To hide the time and keep the date, click on the settings icon and set the Time Format field to none.

Hide time Elementor

Moreover, if you want to add extra text before or after the date, expand the Advanced tab, and enter your custom text.

Add text before date

In our example, I’ve added the ‘Today’s date’ text to the left of the widget, but you can add your custom text instead.

Once finished, please save your changes and visit the page to ensure it meets your requirements.

Conclusion

This article covered when and how to add today’s date to your WordPress website.

We explored a few different methods, one by using a plugin and others by using a theme, function, or page builder.

Leave us a comment and tell us which of the methods above you used to achieve this task.

Also, make sure to subscribe to our YouTube channel and like our page on Facebook.

PluginsForWP

PluginsForWP is a website specializing in redistributing WordPress plugins and themes with a variety of knowledge about WordPress, internet marketing, and blogging.

Leave a Reply