Home » Labs » WordPress code to display posts published between two particular dates  

WordPress code to display posts published between two particular dates


Filed under Labs

Here is a WordPress code to show postes between two particular dates.Just before the loop starts, paste the following code. Change the dates on line 3 according to your needs.

<?php
  function filter_where($where = '') {
        $where .= " AND post_date >= '2012-02-01' AND post_date <= '2012-02-25'";
    return $where;
  }
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>

Posts you may like: