Tag Date

How to make your WordPress posts dates clickable

Do you know that there’s another way to incorporate links to your blog archive in your site without using the archives by date widget by assigning every date on your blog were clickable! Every bit of every date your site contains, and by assigning every bit of your posts date to a link, 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 may need it.

The idea

I was recently designing a new blog theme and I came across an old blog: 1976design.com, the post dates were clickable and were driving reasonable traffic to other parts of the blog. 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 theme.


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.

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