Created
March 30, 2010 19:13
-
-
Save folsen/349463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="year-archive"> | |
<h2>2006</h2> | |
<ul> | |
<?php wp_get_archives('year=2006&show_post_count=true'); ?> | |
</ul> | |
</div> | |
<div class="year-archive"> | |
<h2>2007</h2> | |
<ul> | |
<?php wp_get_archives('year=2007&show_post_count=true'); ?> | |
</ul> | |
</div> | |
<div class="year-archive"> | |
<h2>2008</h2> | |
<ul> | |
<?php wp_get_archives('year=2008&show_post_count=true'); ?> | |
</ul> | |
</div> | |
<div class="year-archive"> | |
<h2>2009</h2> | |
<ul> | |
<?php wp_get_archives('year=2009&show_post_count=true'); ?> | |
</ul> | |
</div> | |
<div class="year-archive"> | |
<h2>2010</h2> | |
<ul> | |
<?php wp_get_archives('year=2010&show_post_count=true'); ?> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Makes the archives filterable by year | |
*/ | |
function getarchives_filter($where, $args) | |
{ | |
if (isset($args['year'])) | |
{ | |
$where .= ' AND YEAR(post_date) = ' . intval($args['year']); | |
} | |
return $where; | |
} | |
add_filter('getarchives_where', 'getarchives_filter', 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment