You really shouldn’t use query_posts()
for anything other than the main loop of that page and use either WP_Query()
or get_posts()
, try this:
$my_query = new WP_Query(
array(
'category_name' => 'interesting_sites',
'posts_per_page' => 3,
'orderby' => 'rand'
)
);
while ($my_query->have_posts()){
$my_query->the_post();
?>
<div <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
</div>
<?php
}
wp_reset_postdata();