我只想列出两个特定日期之间发布的帖子
我在这里找到了一个解决方案http://www.wprecipes.com/wordpress-loop-get-posts-published-between-two-particular-dates
我的代码在这里,不幸的是这不起作用!
<?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; ?>