What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Show Today's Date in WordPress

How to Show Today’s Date in WordPress

It is a good way to show that you are still alive by having the current date on your WordPress site. Limited to knowledge, you may take it for granted that you do not have the ability to get the current date dynamically displayed on your website. In this tutorial, we will guide you how to show today’s date in WordPress.

There are two easy routes available for you: One is via a plugin, and the other is via a shortcode. If you are beginners, we advise you to use the former one which is easier for you to get the job done. Certainly, you are free to deal with a shortcode if you have some coding skills. The main difference between the two methods is that you can only display today’s date on sidebar and footer areas with the former one while you are free to choose the location for today’s date with the latter one.

Show Today’s Date with a Plugin

On the market are many exclusive plugins among which we would like to recommend Date and Time Widget. The reason is that this plugin distinguishes itself from others due to the ease of use. It will create a Date and Time widget for you to stylize the local date and insert it to your widget area. To begin with, it is necessary for you to install and activate the plugin at first.

Upon the activation, you need to drag the Date and Time widget to your sidebar or foot area on the Appearance > Widgets page. Then you have the freedom to decide the background color, time format, date format, text color, font size, and font family. If you just want to show the current date, you should select the Time Format as “None” from the dropdown.

Show Today's Date

And there is no need for you to change the font family which has inherited from your theme’s font. Here a suggestion is that some other settings need to be consistent with your web design. When you save your changes, Date and Time Widget will show today’s date according to your settings.

Custom Design

Show Today’s Date with a Shortcode

There are some instances when you want to find a clean solution. It is possible for you to reach the goal with a shortcode. If you are worried to mess up your website, you’d better create a child theme where you need to add the below code into your functions.php file.

Show Today's Date - PHP Code

At this moment, you have successfully created a shortcode for the current date. With the [datetoday] shortcode, you are able to show today’s date on any WordPress post or page. Note: The date format can be changed on the Settings > General menu.

Show Today's Date - General Settings

Show Today’s Date with a Code

The previous two methods are more perfect for total beginners who have no idea adding code. But developers who are familiar with code may be more willing to use another method. With the consideration of that, we also give a detailed guidance on how to show today’s date with a code.

Two different code snippets are available for you to display the current date. The former one works like the shortcode on the basis of your WordPress settings. And the latter one enables you to specify a unique date format.

  1. <?php echo date(get_option(‘date_format’)); ?>
  2. <?php echo date(‘l jS F Y’); ?>

The example is to position the current date in the header of the theme, which can be seen from the below image.

Show Today's Date - Example

As a result, on your front-end website will be the current date below your header.

Final Verdict

For your convenience, we stick to the idea that you’d better show the current date with a plugin because it is more time-consuming for you to create a shortcode. On one hand,you will spend some time learning how to create a child theme. On the other hand, you have to create a shortcode every time your theme is changed.

Author

Zoe is a freelance writer who has a deep knowledge about WordPress. She loves everything related to website building and loves to share her experience with people all over all the world. In the daily life, Zoe loves detective novels as it can train her logical thinking and creativity.