Title: Multiple query_posts on the same page using loop.php
Last modified: August 19, 2016

---

# Multiple query_posts on the same page using loop.php

 *  [teauser](https://wordpress.org/support/users/teauser/)
 * (@teauser)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/)
 * Hello and thank you for reading this.
 * Does anyone know how to have two different query_posts on the same page if the
   twentyen theme (with loop.php) is being used?
 * I would like to show the first post of different categories on different divs
   on the same page.
 * Thanks a lot!

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

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/#post-1712059)
 * Run a [second loop/query](http://codex.wordpress.org/The_Loop#Multiple_Loops)
   after loop php has been called.
 *  Thread Starter [teauser](https://wordpress.org/support/users/teauser/)
 * (@teauser)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/#post-1712080)
 * Hi esmi, thank you for your reply.
 * The problem is that I’m using the loop.php file from the Twentyen theme and it’s
   just one loop for all pages.
 * Thanks for your help 🙂
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/#post-1712083)
 * You can still have a second loop – after `get_template_part( 'loop', 'index' );`
   in index.php for example.
 *  [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * (@adeptris)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/#post-1712098)
 * In the index.php or better still a template page, you should limit the posts 
   as well add `&'posts_per_page' => 5`
 *     ```
       //Do Layout stuff
       //Query One
       $args=array(
          'cat'=> 3,
          'posts_per_page' => 5,
       );
       query_posts($args);
   
       //Get the Posts
       get_template_part( 'loop', 'index' );
       wp_reset_query();
   
       //Do Layout Stuff
       //Query Two
       $args=array(
          'cat'=>4,
          'posts_per_page' => 5,
       );
       query_posts($args);
   
       //Get the Posts
       get_template_part( 'loop', 'index' );
       wp_reset_query();
   
       //Do Layout Stuff
       //Query Three
       $args=array(
          'cat'=>7,
          'posts_per_page' => 5,
       );
       query_posts($args);
   
       //Get the Posts
       get_template_part( 'loop', 'index' );
       wp_reset_query();
   
       wp_reset_postdata();
       //Get the Original Page ID for comments etc:
       ```
   
 * HTH
 * David

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

The topic ‘Multiple query_posts on the same page using loop.php’ is closed to new
replies.

## Tags

 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Digital Raindrops](https://wordpress.org/support/users/adeptris/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/multiple-query_posts-on-the-same-page-using-loopphp/#post-1712098)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
