Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How to Show Today’s Date in WordPress

How to Show Today’s Date in WordPress

Showing today’s date gives the website a sense of continuance. It makes it looks like the site is relevant to the present. Even if the last piece of content was created in 2009, the current date gives the site a “here-and-now” appeal.

Today, I’m going to delve into how you can add the date to a WordPress website. It’s a small addition that may improve how visitors view the content.

There’s actually a few different ways this can be done. I’ll go over some of the easiest methods that can quickly put the current day proudly on your website design.

Method #1: Using a Specific Theme

Many themes that are available on WordPress have the ability to show today’s date without adding extra coding. For example, the ColorMag theme has an option you can easily turn on and off at your leisure. Does your theme have this ability? It’s easy to find out.

To check your theme for a date control:

Go to the appearance area of the WordPress admin panel.

go to the appearance

The first window that loads is your theme management page. Click the “Customize” button located on the theme you are currently using.

click the customize button

When the WordPress customizer appears, you’ll see a variety of options on the left side. The customizer allows users to change the look of a theme in most cases. These are the controls for your theme. Some will have more options available than others. It will be in this section where you will look for a control that reads, “Show Date.” Of course, this may be different depending on the theme you are using.

NOTE: Start by checking in the “Header Options” if your theme supports this feature. Usually, date controls are in this area.

header options

If you’re able to add the date to your theme’s appearance from the customizer, click the “Save” button near the top left of the screen.

save and publish

Once the settings are saved, clicked the “X” in the top left corner to close the customizer. This will take you back to the WordPress admin dashboard.

click x

Because every designer is different, not all themes will have the same abilities when making adjustments. However, you may find that your theme supports far more capabilities than you thought if you take a look in the customizer. Some will even include social sharing buttons and other small tools.

Method #2: Using a Plugin

You would think that adding a current day would be an easy plugin to find. Unfortunately, they are not very many when you search for them in WordPress. This may be due to using the time-stamp on posts or within themes. Regardless, there are few plugins that you can use to display the current date.

For this tutorial, I’m using the Date and Time Widget. Although this plugin isn’t regularly updated, I did test it with WordPress version 4.7.1. It works flawlessly and has a few customizing options available.

To use Date and Time Widget:

Go to “Plugins” from your WordPress admin panel.

go to plugins

Click the button to add a new plugin and search for, “Date and Time Widget.”

add date and time widgets

Install and activate the plugin.

install plugin

Go to the appearance area of the WordPress admin panel and click on, “Widgets.”

click on widgets

Find the widget labeled, “Date and Time.” Drag it over to your sidebar and drop it in place.

drag to sidebar

NOTE: Most people want the dates to appear in the top area of the website. You can move this easily thanks to the drag-and-drop editing in WordPress.

When it expands, you can customize its options:

Time Format: Lets you select how you want time to display.

Date Format: Allows you to choose how month, day and year appears.

Font Family: Choose which font you want the widget to use.

Font Size: Changing the size of the font will let you fit the widget perfectly in your site design.

Text Color: You can modify the colors of the widget by using hexadecimal code or manual.

Background Color: By default, this widget’s background is transparent. However, you can easily modify it to fit your design.

customize options

Once your options are ready, click the “Save” button on the bottom of the widget.

save widgets

By default, the only place you can put a widget in WordPress is in the sidebar. However, there are many themes and other plugins that will give you more control where you can place these little tools. For instance, the Page Builder by SiteOrigin gives you the power to place widgets directly into a page or post.

The Date and Time plugin bases its data on the user’s computer system. This means that it really doesn’t matter what your website is set to in terms of a time zone. It will show the local day and time of the visitor. If you still want to adjust your website’s time, it can be found by going into the Settings area of WordPress and using the drop down control next to, “Timezone.”

Method #3: Adding the Date Using Code

This next method is a bit more tricky for those who don’t know how to add code to a website. Although it’s not difficult, it still means you need to access the underbelly of WordPress. In this example, I’m going to add data to the header of the theme.

To edit the code of your website to show the current date:

Go to the appearance area of the WordPress dashboard and click on the “Editor” tool.

click on editor tool

Search for the header.php file.

header php

NOTE: It’s often labeled as, “Theme Header” in WordPress.

Click this file to load it in the editing screen.

Here’s where it gets a bit tricky. Locate the block of code for “header.” It may be easier if you use the “find” function in your browser.

locate the block of code

Paste the following code at the end of the block just before the </header> command:

<?php echo date(get_option(‘date_format’)); ?>

paste code

Click the “Update File” button below the editor.

click update file

Now, your website will show the current time-stamp that you are using in WordPress. If you want to show something different, you can modify how your date appears by accessing Settings.

Alternatively, you can use coding that is different from your WordPress settings by pasting the following PHP instead:

<?php echo date(‘l jS F Y’); ?>

This code will show the day’s label as well. For example, the lowercase “L” will show “Monday” or whichever day it is currently. The actual format of the date itself can be modified by using PHP commands to change the format of the code itself. In reality, there is a lot you can do simply by changing around the letters in between the (‘ and ‘).

It’s important to note that modifications to your theme’s header through the editor are subject to being removed should the theme be updated. So, adding the above code again will be necessary if the developer creates a new version. This is one of the reasons why many WordPress developers will use child themes instead.

Adding today’s date can be a simple process, depending on how much work you want to put into it. However, it’s probably a good idea if you want people to feel more connected. Just by simply adding a time-stamp to the website, many people will view its relevance differently.

What kind of simple add-ons do you use to keep your visitors interested? How often have you come across a plugin that saved you from having to add code manually?


Author: Kaumil Patel

Kaumil Patel is the Chief Operating Officer of GreenGeeks and has over 13 years of experience in the web hosting industry working for and owning web hosting companies. Kaumil’s expertise is in marketing, business development, operations, acquisitions and mergers.

Was this article helpful?

Related Articles

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.