How to display current date on WordPress page or post

by Galyna on October 28, 2011

Sometimes you need to show current date on your page or post of WordPress blog.
You can often see it on affiliate products pages. It makes your website look current and like it’s updated daily.

Here is step-by-step guide how to do that:

1. Add to functions.php code below (copy and paste it at the end of file)

// [date]
function displaydate(){
return date(‘l, F jS, Y’);
}
add_shortcode(‘date’, ‘displaydate’);
// end date

2. To insert current date anywhere in WordPress blog insert this shortcode:

[date]

Here is what you should see in your blog:
Dynamic "Today's Date" Date

{ 1 comment… read it below or add one }

1 Anton 10.28.11 at 4:00 pm

Cool tip! I’ve been looking for this code. Some themes display it but majority of wp themes don’t have this.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>