Title: Order posts by category
Last modified: August 22, 2016

---

# Order posts by category

 *  [baljit12](https://wordpress.org/support/users/baljit12/)
 * (@baljit12)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/order-posts-by-category-2/)
 * HI,
 * I have the Categoried like cat1,cat2,cat3,cat4
    Now, I want to create a template
   or page which shows firstly all posts from cat2 and then after all posts from
   cat3.
 * Thanks.

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

 *  [Josh](https://wordpress.org/support/users/josh401/)
 * (@josh401)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/order-posts-by-category-2/#post-5368560)
 * Create one loop… then create a secondary loop.
 *     ```
       <?php
       $cat2 = new WP_Query('category_name=cat2');
   
       while ($cat2->have_posts()) : $cat2->the_post();
         // Do your loop stuff for category two here...
         the_title();
         the_content();
       endwhile;
       ?>
       ```
   
 *     ```
       <?php
       $cat3 = new WP_Query('category_name=cat3');
   
       while ($cat3->have_posts()) : $cat3->the_post();
         // Do your loop stuff for category three here...
         the_title();
         the_content();
       endwhile;
       ?>
       ```
   
 *  Thread Starter [baljit12](https://wordpress.org/support/users/baljit12/)
 * (@baljit12)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/order-posts-by-category-2/#post-5368562)
 * Thanks. Buddy…
    I will try this now.

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

The topic ‘Order posts by category’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [baljit12](https://wordpress.org/support/users/baljit12/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/order-posts-by-category-2/#post-5368562)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
