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 methods 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 time format, date format, font family, font size, text color, and background color. If you just want to show the current date, you should select the Time Format as “None” from the dropdown.
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.
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.
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.
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.