How to display today's date in WordPress (2 easy ways)
Apr 20, 2025 am 07:27 AMDo you want to display today's date in WordPress?
Many news websites, online journals, and frequently updated blogs may want to show the current date and time. This allows users to know the current date and when the content was published.
In this article, we will show you how to easily display today's date or current time on your WordPress website.
Why do you display today's date in WordPress?
Many news sites display current dates in the title section of their website, especially small news sites that publish their main stories every day.
This assures the user that they are viewing the latest version of the online version of the publication. This is a useful style decision, and many news sites are still in use, although the homepage is updated several times a day.
Similarly, online journals and bloggers have adopted this style. This ensures that the user is viewing the latest entries on the blog.
In other usage scenarios, you may want to display only the current date and time.
For example, if your live chat is taking place at a specific time and you want to show the customer the time you are in your geographic location. Alternatively, you are running a countdown timer activity and want to display the current date to create a stronger FOMO effect.
That being said, let's see how to easily display today's date, day of the week, or current time on your WordPress website. We will introduce two methods:
- Show today's date by adding code to the template file
- Use a shortcode to display today's date anywhere
Method 1: Display today's date by adding code to the template file
WordPress does not come with a default widget or block to display the current date or time.
However, you can still use some very simple code to display the current date or time.
You can add this simple code to the template file for the WordPress theme you want to display time:
You can also use your own format tag to output dates in any other format. For example, using the following code, you can print dates in month, day, year formats.
This approach allows you to add code directly to your WordPress theme file, but is not very flexible. What if you want to display the current date and time in a WordPress post, page, or sidebar widget?
The next method allows you to add dates and times anywhere on your website.
Method 2: Use the shortcode to display today's date anywhere (recommended)
For this method, we will create a short code and then use it to display the date and time anywhere on the WordPress website.
You can add the following code to the theme's functions.php file, or use a custom code snippet plugin, such as WPCode (recommended):
This code just creates a short code that displays the current date. You can use it by adding this shortcode anywhere on the website:
[date-today]
By default, the shortcode displays the date in the default date format in WordPress settings.
You can also use your own date format by modifying the shortcode as follows:
[date-today format='F j, Y']
We hope this article helps you understand how to easily display today's dates in WordPress. You may also want to check out our guide on how to add weather forecasts in WordPress, or our expertly selected Best Quiz Plugins for WordPress.
The above is the detailed content of How to display today's date in WordPress (2 easy ways). For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

As July 2025 approaches, the crypto market is hotly discussing which tokens may bring high returns. Are names like Pi, PEPE and FloppyPepe really worth the risky investment? Potential cryptocurrencies worth paying attention to in July 2025: virtual fire or real gold? As mid-2025, the heat of discussions on high-yield crypto assets continues to heat up. Bitcoin trends and "altcoin season" expectations have attracted investors' attention. Do tokens like PiNetwork, PEPE and FloppyPepe have the potential to bring considerable investment returns? Let's analyze its prospects one by one. Altcoin Market: Can July get what it wants? Against the backdrop of Bitcoin’s expected record of historical highs, the “altcoin season” seems to be brewing. Back

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The latest version of Binance is 2.101.8, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

Polkadot is causing heated discussion on the stage of DeFi and cross-chain integration! Let’s analyze its underlying technical structure, ecological construction progress, and the core driving force that helps DOT move towards its $5 price target. Polkadot, DeFi and Cross-chain: Observation from New York, Polkadot is setting off a new wave of craze in the DeFi and cross-chain fields. The crypto market is changing, but DOT is gradually emerging. Next we will explore the factors behind its rise. Interoperability: Polkadot's core competitiveness Polkadot's most significant advantage is its ability to connect and connect with different blockchains. You can compare it to being a universal world of blockchain

Contents 1. What is ICN? 2. ICNT latest updates 3. Comparison and economic model between ICN and other DePIN projects and economic models 4. Conclusion of the next stage of the DePIN track At the end of May, ICN (ImpossibleCloudNetwork) @ICN_Protocol announced that it had received strategic investment in NGPCapital with a valuation of US$470 million. Many people's first reaction was: "Has Xiaomi invested in Web3?" Although this was not Lei Jun's direct move, the one who had bet on Xiaomi, Helium, and WorkFusion

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The latest version of Binance is 2.101.8, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.
