How to make your Wordpress posts dates clickable

Do you know that your blog would prove all the visitors’ nightmares wrong if every date on your blog were clickable! Every bit of every date your site contains, and by every bit I mean the three major parts the average date format contains —month, day and year.

I know many of you are already aware about this little trick, but I posted this because many people will need it.

The idea

I was recently designing a new theme for my blog and one day I came across an old blog: 1976design.com. The blog has nothing to do with Wordpress and its run by hand crafted blog application written by the owner of the website, but it still inspired me to implement the idea on my own blog.

Implementation

Open your theme’s index.php and find the template tag <?php the_time(); ?> then replace that with the following code:


// The month
<a title="<?php the_time('F') ?>" href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>"><?php the_time('F') ?></a>
// The date
<a title="<?php the_time('F') ?> <?php the_time('jS') ?>" href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>/<?php the_time('m') ?>/<?php the_time('j') ?>"><?php the_time('jS') ?></a>,
// The year
<a title="<?php the_time('Y') ?>" href="<?php bloginfo('url'); ?>/<?php the_time('Y') ?>"><?php the_time('Y') ?></a>

The above code will show something like this: May 14th, 2009.

What do you think?

If you think there is a better way to do this thing or if you have something else to add or to say about this, please share it in the comments part.

Entry info

This entry was posted 10 months, 1 week ago on Thursday, May 14th, 2009 at 8:21 pm and is filed under WordPress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Tags: , , , ,

3 Responses to “How to make your Wordpress posts dates clickable”

  1. Sami says:

    Hello. This is simple approach :) I’ll implement it on my upcoming site!

    Thank you

  2. wolf says:

    Works great! Thanks!

  3. PeterG. says:

    It will be my one of my next tasks to implement that.
    Thank you for that nice trick!

Leave a reply





AboutMe

Hey ;-) Hello, this is gunnerpress.com. My name is J Mehmett; unpopular follower of WP, PSD, PHP, design, Arsenal FC and all the extremely nasty stuff... Read my profile »

MyFlickrphotos

  • Toyota Mark II
  • Riots in Bosaso I
  • Riots in Bosaso II
  • Factory
  • Bolo-Bolo
  • Soomaali baan ahay!!
  • Boat
  • Boat @ Bosaso

Go to my Flickr photos »