• Resolved DavidG2

    (@davidg2)


    Just realized I posted this in the wrong forum, that’s why I got no replies, hopefully this is the right one. So here we go…

    I’m having a bit of a problem with my WordPress coding, I’m trying to get posts randomly from a set of posts. The problem I’m having right now is the orderby=rand part of the query.

    <?php $week = date('W'); $year = date('Y');	$headline = new WP_Query( 'year=' . $year . '&w=' . $week  ); $headline->query('posts_per_page=5&orderby=rand&showposts=1&tags=featured+breaking+BreakingNews+breaking news+specials+special+announcements'); while ($headline->have_posts()) : $headline->the_post(); $do_not_duplicate = $post->ID; ?>

    When I execute the site with the rand string, the posts don’t work. However when ordered by date, it’s perfectly fine. I don’t see anything that’s wrong with the PHP code! Can anybody help?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP_Query Problems — "orderby=rand" not working :/’ is closed to new replies.