I have wordpress plugin and there I have this query and filter:
<?php
function filter_where($where = '') {
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
?>
<?php query_posts('meta_key=post_views_count&orderby=meta_value_num&order=DESC&ignore_sticky_posts=1&posts_per_page='. $numposts ); ?>
I need to get posts that are most read in 7 days, but this query only shows posts last 7 days, and when I do not type any post in lasts 7 days, plugin will show no posts = I must write posts... But I want to make that will show always most read posts in 7 days...
Thank you very much