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.
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'
)); ?>