Monday, May 14, 2012

WP Query to list posts published between two particular dates

I just want to List the posts published between two particular dates



I found a solution Here http://www.wprecipes.com/wordpress-loop-get-posts-published-between-two-particular-dates



and my code is Here, unfortunately This is not working !!



<?php
function filter_where($where = '') {
$where .= " AND post_date >= '2012-05-09' AND post_date <= '2012-05-11'";
//$where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>
<?php while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php endwhile; ?>




No comments:

Post a Comment