Title: multiple loop question
Last modified: August 20, 2016

---

# multiple loop question

 *  [hyperdrive](https://wordpress.org/support/users/hyperdrive/)
 * (@hyperdrive)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/multiple-loop-question-3/)
 * Hello,
 * I have a loop in the header for slide images which is affecting the loop in single.
   php. What is the correct way to format so it doesn’t affect the main loops?
 * This is the header loop im using
 *     ```
       <?php query_posts('showposts=4'); ?>
         <?php while (have_posts()) : the_post(); ?>
       		<?php
       		if ( has_post_thumbnail() ) {
       		  the_post_thumbnail('large-image');
       		}
       		?>
       <?php endwhile; ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  [Hennessey Digital](https://wordpress.org/support/users/wpthemesnz/)
 * (@wpthemesnz)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/multiple-loop-question-3/#post-3422792)
 * It is best to create a custom query: [http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters)
 *     ```
       <?php
       $args = array('posts_per_page' => 4);
       $new_query = WP_Query( $args );
   
       while( $new_query->have_posts() ): $new_query->the_post(); ?>
       		<?php
       		if ( has_post_thumbnail() ) {
       		  the_post_thumbnail('large-image');
       		}
       		?>
       <?php endwhile; ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘multiple loop question’ is closed to new replies.

 * 1 reply
 * 2 participants
 * Last reply from: [Hennessey Digital](https://wordpress.org/support/users/wpthemesnz/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/multiple-loop-question-3/#post-3422792)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
