See if this gets you there:
<?php
$today = getdate();
$showpost = new WP_query();
$showpost->query(‘showposts=’.$options[‘left_X_news’].’&cat=-‘.$options[‘photos_id’].’,-‘.$options[‘videos_id’].’,-‘.$options[‘celebrities_id’].’&orderby=rand&year=’ .$today[“year”] .’&monthnum=’ .$today[“mon”] .’&day=’ .$today[“mday”]);
?>
Hi MichaelH,
the above solution solved my problem, but leads to a new problem. If i don’t have posts for today then the above query returns nothing. is it possible to add an if condition that if the above mentioned returns nothing, then show posts from the last 7 days in the random order?
how to achieve that? please help me.
[moderated–bumps removed. Please refrain from bumping as per Forum Rules]