I think this must have been solved many times here on WordPress Answers.
You could also check out the examples in the Time parameters part in Codex for WP_Query
.
Here are two of them (slightly modified to your needs)
Example 1:
// Create a new filtering function that will add our where clause to the query
function filter_where( $where = '' ) {
// posts in the last 7 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-7 days')) . "'";
return $where;
}
add_filter( 'posts_where', 'filter_where' );
$slider_query = new WP_Query('posts_per_page=5&cat=3&orderby=highest_rated&order=desc');
remove_filter( 'posts_where', 'filter_where' );
Example 2:
// Create a new filtering function that will add our where clause to the query
function filter_where( $where = '' ) {
// posts for May 1 to March 8, 2013
$where .= " AND post_date >= '2013-05-01' AND post_date < '2013-05-8'";
return $where;
}
add_filter( 'posts_where', 'filter_where' );
$slider_query = new WP_Query('posts_per_page=5&cat=3&orderby=highest_rated&order=desc');
remove_filter( 'posts_where', 'filter_where' )
assuming that you have this orderby=highest_rated
covered with some plugin as you describe in the comment above.
orderby=highest_rated
isn't inbuilt in WordPress. Are you using some plugin for ratings?