Help with using NOW()
-
Hi, These forums are great. I’ve searched thoroughly and using code I found on these pages implemented a random post on my “home” page.
I have 2 posts “in the loop” and then the random post. I want to have the random post NOT be the same as either of the previous two. Say, have the random one be older than 7 days.
I’ve done this:
<?php
$rand_id = $wpdb->get_var(“SELECT ID FROM $wpdb->posts WHERE post_status = ‘publish’and post_date < NOW() ORDER BY RAND() LIMIT 1”);
query_posts(“p=$rand_id”);
?>I think the < NOW() keeps the post from being from today. But how do I change it so the post is AT LEAST 7 days old OR MORE?
Thanks in advance,
bboldb
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Help with using NOW()’ is closed to new replies.