Title: Randomise Posts Inside Category
Last modified: August 19, 2016

---

# Randomise Posts Inside Category

 *  [obiemc](https://wordpress.org/support/users/obiemc/)
 * (@obiemc)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/)
 * Hello im just wondering if there is a way to have the posts inside my categories
   randomise every time you click into it.
 * What it is i have advertisers saying there at the bottom as they have been with
   us a long time and new adverts are at the top.
 * So would be great if it could change every time you go into it.

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/#post-1858949)
 * try to add something like this:
 *     ```
       <?php global query_string;
       query_posts($query_string . '&orderby=rand'); ?>
       ```
   
 * before the start of the loop in category.php (or archive.php) of your theme
 * [http://codex.wordpress.org/Function_Reference/query_posts#Orderby_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Orderby_Parameters)
   
   [http://codex.wordpress.org/Function_Reference/query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
 *  Thread Starter [obiemc](https://wordpress.org/support/users/obiemc/)
 * (@obiemc)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/#post-1858999)
 * Thanks will give this a try
 *  Thread Starter [obiemc](https://wordpress.org/support/users/obiemc/)
 * (@obiemc)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/#post-1859016)
 * Is this in the theme files?
 * As i dont have either category.php or archive.php in there?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/#post-1859029)
 * [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 * themes don’t neccessary need a archive.php, or category.php;
    however, if you
   want to make specific modifications in the category page, it helps to have this
   category.php.
 * to make one, create a new file in your theme with the name `category.php` and
   paste the whole code from index.php into it.
 * then make the edits in category.php

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

The topic ‘Randomise Posts Inside Category’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/randomise-posts-inside-category/#post-1859029)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
