I’m trying to display the 5 best rated posts of the last week (7 days) on my website, however I can’t seem to figure out how to display them.
Here’s what I’ve achieved so far but it doesn’t seem to work:
<?php $slider_query = new WP_Query('posts_per_page=5&cat=3&orderby=highest_rated&order=desc'); ?>
<?php
$mylimit = 7 * 86400; //days * seconds per day
while ($slider_query->have_posts()) : $slider_query->the_post();
$post_age = date('U') - get_post_time('U');
if ($post_age < $mylimit) {
?>
//The Post
<?php } ?>
<?php endwhile;?>