Skip to content

Instantly share code, notes, and snippets.

@ckunte
Created April 2, 2015 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckunte/467e09ee4370f26a23a1 to your computer and use it in GitHub Desktop.
Save ckunte/467e09ee4370f26a23a1 to your computer and use it in GitHub Desktop.
Dateline linked to archive by day, month and year (for WordPress)
//
// WordPress has a built-in support for archive by day, archive by month,
// and archive by year, and so, this following snippet converts the dateline
// below each post linkable by day, month, and year to the archive.
// 2008 ckunte
//
<?php
$arc_day = get_the_time('j');
$arc_month = get_the_time('m');
$arc_year = get_the_time('Y');
?>
// Converting'em into linkable dates
<?php the_time('l'); ?>,
<a href="<?php echo get_day_link($arc_year, $arc_month, $arc_day); ?>"><?php the_time('jS') ?></a>
<a href="<?php echo get_month_link($arc_year, $arc_month); ?>"><?php the_time('F') ?></a>
<a href="<?php echo get_year_link($arc_year); ?>"><?php the_time('Y') ?></a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment