|
You'll need to add a condition to the
posts_where
filter in wordpress. I have an example here for only pulling posts that are from the current post's date and earlier:
Add this to functions.php
// filter wp_query when $dated_before is set
function dg_dated_before($where)
{ global $wp_query, $wpdb, $dated_before; if (isset($dated_before)): $where = $where . " AND $wpdb->
posts.post_date <= '". $dated_before . "' " ; endif; return $where ;
}
add_filter('posts_where', 'dg_dated_before') ;
Use this, or similar wherever it is that you are running your query:
global $dated_before;
$dated_before = $post->
post_date;
$queryObject = new WP_Query();
You'll obviously need to modify this to add the date boundaries that you need.
|