I would like to show only the posts of the last X day's on my wordpress frontpage. Let's say, a week, so 7 day's.
What's the propper way to tell wordpress to select only the posts in the last X day's in the loop?
Currently, I've got it working trough a hack, but it messes up the pagination. Going to the next page does not select the right posts.
//Hack found on the bottom of http://codex.wordpress.org/Template_Tags/query_posts
function filter_where($where = '') {
//posts in the last 7 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
}
add_filter('posts_where', 'filter_where');
query_posts($query_string);
if ( have_posts() ) : while ( have_posts() ) : the_post();
... and the usual