Title: post random
Last modified: August 21, 2016

---

# post random

 *  [zinc1314](https://wordpress.org/support/users/zinc1314/)
 * (@zinc1314)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/post-random/)
 * Hi everybody!
 * I have this code
 *     ```
       <?php while(have_posts()): the_post(); ?>
               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       ```
   
 * And i can’t do random posts. Someone can help me please?
 * thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [zinc1314](https://wordpress.org/support/users/zinc1314/)
 * (@zinc1314)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/post-random/#post-4105217)
 * sorry, i have this code now
 *     ```
       <?php $home_query = new WP_Query("cat=&showposts=8&orderby=rand"); $i = 0; ?>
       		<?php while ($home_query->have_posts()) : $home_query->the_post();
       $do_not_duplicate = $post->ID; $i++; ?>
       ```
   
 * But with AStickyPostOrderER plugin, make random but only with sticky category.
 * Some solution?

Viewing 1 replies (of 1 total)

The topic ‘post random’ is closed to new replies.

## Tags

 * [have_posts()](https://wordpress.org/support/topic-tag/have_posts/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [the_post()](https://wordpress.org/support/topic-tag/the_post/)

 * 1 reply
 * 1 participant
 * Last reply from: [zinc1314](https://wordpress.org/support/users/zinc1314/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/post-random/#post-4105217)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
