• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Gokul Deepak

Gokul Deepak

GoCool and Debug

  • Home
  • WordPress
  • Android
  • How to
  • About Me

How to Display Today’s Date in WordPress

June 28, 2017 by Gokul Deepak S Leave a Comment

Many blogs and websites use Magazine style of theme and so the like to add date in the page. It was first started by newspapers but now many non newspaper blogs too wanted to display date. Displaying todays’s date looks professional. Before somedays adding Today’s date was difficult but now after many updates it is very easy in wordpress to display Today’s date in any wordpress theme. Yes, You can use it in Studiopress, Genesis, Theme forest and in any theme. Let me share this simple method to display Today’s date in WordPress. This method is not onl exclusive for wordpress but you can also apply this for any PHP based websites.

Display Today’s Date:

Place this code in header.php

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

If you are using Genesis theme then simply paste this using Simple hook theme.

The above code will display the date in the following format:

Friday, 1st September 2017

You can also change the format of this date using PHP format.

How to Display Today’s Date in WordPress

To Add Color in Date:

Using CSS you can change the colors. To use css add the date template tag like this:
<span class="date"><?php echo date('l jS F Y'); ?></span>

Now in your theme’s style sheet you can add CSS, like this:
.date {
color: blue;
border: 1px solid #CCC;
}


Method 2:

Go to Settings > General and select the date format in there and simply add this code instead of the above one:
<?php echo date(get_option('date_format')); ?>

Filed Under: Wordpress

Authored by Gokul Deepak S

Leave a Reply Cancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular Pages

  • How to find the date of the Facebook group it was created
  • How to add ads.txt on Bluehost
  • Elementor Plugin and Nginx Configuration
  • Home
  • CORS error in Apache Tomcat - Solved
  • Combine two separate files line by line in Notepad++

Archives

Categories

  • Android
  • Apache
  • AWS
  • Blogger
  • Computer Tips
  • DevOps
  • Docker
  • Earn
  • Facebook Tips
  • Git
  • Google Tips
  • Hosting
  • How to
  • Laptop Tips
  • Laptops
  • Linux
  • Mobile
  • MongoDB
  • Nginx
  • Node JS
  • Notepad++
  • PostgresQL
  • Ubuntu
  • Wordpress
  • Xenforo

Tags

Android Android One AWS Bluehost Comparisions Custom ROM Elementor Facebook Genesis Genesis Sample Theme Google Drive How to Lineage OS Notes OnePlus One OwnCloud Rooting Smartphones Stock ROM Studiopress Tomcat Wordpress plugin

Copyright © 2023 · Maintained by GokulDeepak

wpDiscuz