Permalink
Browse files

allow customizing which posts appear on archives page

  • Loading branch information...
1 parent 83b96a6 commit 03a97e3a694b544d25dc818f64e9a588de0bdadd @willnorris committed Feb 25, 2012
Showing with 11 additions and 3 deletions.
  1. +11 −3 content/archives.php
View
@@ -1,12 +1,20 @@
<h2><?php the_title(); ?></h2>
<?php
+$args = array('showposts' => -1);
+$args = apply_filters('pdx_archives_query_args', $args);
$_year = 0;
$allPosts = new WP_Query();
-$allPosts->query('showposts=-1');
+$allPosts->query($args);
while ($allPosts->have_posts()):
$allPosts->the_post();
+
+ // allow posts to be excluded from the archive list beyond what is
+ // possible with arguments to WP_Query. For example, based on post_format
+ $include = apply_filters('pdx_archives_include_post', true, $post);
+ if (!$include) continue;
+
$year = mysql2date('Y', $post->post_date);
if ($_year != $year):
@@ -23,7 +31,7 @@
</li>
<?php endwhile; ?>
</ul>
-<?php
+<?php
// return things back to normal
- wp_reset_postdata();
+ wp_reset_postdata();
?>

0 comments on commit 03a97e3

Please sign in to comment.