Display Date As Set In WordPress Date Format Setting

WordPress has the option of setting the date display type in it. And we can display the current date using the PHP code. And what about displaying the current date setup in WordPress Date Format setting? Is it possible? Well, it is possible and here we are describing about how to do it.

Which sites requires date to display?

So, it may come into your head that like which type of site does the date display is required?  Well, the answer to this question is very simple. You require to display the current date mostly on the news sites, why? Because, mostly the news is always updated and you would like to inform the users to your site about the current day.

Similarly, in the rare case, what if you are developing the blogging sites and want to display the current date to your users? Well, in this condition too, you may need this.

So, after knowing something about in which type of sites, the date display is required, so, you may now have been excited about how to achieve it for your site, right? Well, let’s move ahead and display the date in your site setup the date format setup in WordPress Date Format setting.

How to display the date setup in WordPress Date Format setting?

You can setup the date format in WordPress via Settings->General->Date Format setting section. So, how about displaying the visitors to your site the current date? Will it be a good idea? Well, as we have already discussed about it above about why and which sites requires it.

Now, since you know about where you can set the WordPress date format in WordPress dashboard and the importance of displaying the current date in your site, now, you may be eager about how to do it. So, why the wait on this more? Hence, let’s move ahead and know about how to do it for your site?

For the date display code, you can add the below PHP code in the header.php file in your theme as required:

Now, if you add above code in the file as mentioned above then, it will display the current date in your site. And the date format can be changed for your site via Settings->General->Date Format. And after you have set it, you can see the difference at once when you view the site again.

From this, what we can say is, you have achieved the feature of displaying the current date to your visitors set in WordPress Date Format setting.

But, what if you want to show the date to the visitors not set up in the WordPress Date Format setting? Is is really possible? Yes, it is possible. You just need to use the below PHP code instead in the header.php file:

Output of the date display set in WordPress date format setting

Now, you may want to know about how the output for this feature will be, right? Well, the output will be like the below screenshot for your site too on this:

You may also want to read:

  1. Tutorial On Creating WordPress Child Theme
  2. Creating Contact Us Page Via Contact Form 7 Plugin
  3. Display Different Header Image Per Different Pages
  4. Display Different Widgets Per Different Pages

Conclusion

Now, if you have followed this tutorial properly and successfully implemented the featured of displaying the current date to the visitors of your site setup in WordPress Date Format setting then, we can assume that you are now more familiar on this than before. But, if you are still in confusion on this and want to know more on this then, do let us know via the comment below in the comment box and we will follow it up.

, , , , , , , , , , , , , , , , , ,

Post navigation

Bishal Napit

Bishal Napit is a WordPress theme developer from Tansen, Palpa, with a passion to learn more on WordPress.

Leave a Reply