How Can You Show Current Date In WordPress Website?
September 16th, 2016 | by Ravi Chahar || 4 Comments |
Nowadays the bloggers want to show current date in WordPress website. There are many WordPress themes which consist this features. But what would you do to display today’s date on your website?
When you see the date on any other website and thinking about showing it on your website then you can easily show that. Most of the blogger seek for the proper solution so that they can add the code in their current theme.
Though there is nothing much to do. You just have to add one line of the code and the date will be showing on your website.
If you good with PHP then you would be aware of the PHP date showing rules. If not then let me give you an example.
Add One Line of PHP Code To Show Current Date In WordPress Website.
You may have noticed that on many websites the date displays at the upper-left corner or the right corner of the website.
If you too want to show the date in the header area then you have to edit the header.php file. If you want to display the date in the footer area then you have to edit the footer.php.
Choose your location and then edit that file. If you know the WordPress theme file structure then it won’t be a problem to edit the theme files.
Let me show you the code:-
The output would be “day,date month year”. For example “Friday, 16th September 2016“. using the above code the year will be showing with the all four digits.
If you want to show only two digits then replace the uppercase “Y” with lowercase “y”. You can check all the ways to show the date using the PHP at PHP Manual.
If you want to show the “AM/PM” then it is possible with the use of simple “A”. There are many other options to display the date format on your website.
You can choose any of them.
Can You Now Show Current Date In WordPress Website?
Though there was nothing hard to look upon. Just the one line of the code. I hope now you can display today’s date on your website.
Just make sure the location of the date. You can use any HTML element to put the date. It would be easy for you to design it according to the color combination of your website.
If you still face any problem then feel free to ask. I will try to provide the best possible solution.