Title: Problem with multiple loops on single.php – advice needed
Last modified: August 18, 2016

---

# Problem with multiple loops on single.php – advice needed

 *  [mattkevan](https://wordpress.org/support/users/mattkevan/)
 * (@mattkevan)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/problem-with-multiple-loops-on-singlephp-advice-needed/)
 * Hi, I’m having a bit of problem with putting multiple loops on the single.php
   page.
 * Basically, I want two additional loops showing specific posts from specific categories
   as well as the full text of a post. For some reason the loops are conflicting
   with one another – instead of showing the post text, it shows the content of 
   one of the other loops.
 * The code I’m using for the additional loops is:
 *     ```
       <?php $posts = get_posts( "category=10&numberposts=1" ); ?>
       <?php if( $posts ) : ?><?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
       <?php the_content('Read more &raquo;'); ?>
       <?php endforeach; ?>
       <?php endif; ?>
       ```
   
 * (the only difference between the two additional loops is the category number 
   and number of posts)
 * The code to display the full single post is :
 *     ```
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       <div class="post">
       <h2><?php the_title(); ?></h2>
       <div class="contenttext">
       <?php the_content('<p>Read more &raquo;</p>'); ?>
       </div>
       <?php link_pages('<p><strong>Pages:<strong> ', '</p>', 'number'); ?>
       <p class="postinfo"><strong>Posted:</strong> <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?>.<br />
       <a href="<?php comments_link(); ?>"><strong>Comments:</strong> <?php comments_number('none','1','%'); ?></a>
       <?php edit_post_link('Edit this post',' | ',''); ?></p>
       <?php comments_template(); ?>
       <?php endwhile; else: ?>
       <p>No matching entries found.</p>
       <?php endif; ?>
       </div>
       ```
   
 * You can see them in action [here](http://82.110.105.87/theillustrationgallery.com/2007/07/04/claire-scully/).
 * I fear my knowledge of PHP and/or WordPress isn’t enough to figure this one out
   by myself, so if anyone has any ideas I’d be most grateful. Thanks!

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

 *  [Ryan Hellyer](https://wordpress.org/support/users/ryanhellyer/)
 * (@ryanhellyer)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/problem-with-multiple-loops-on-singlephp-advice-needed/#post-590629)
 * I had the same problem and solved it using the method recommended here … [http://www.webtalkforums.com/showthread.php?p=59973](http://www.webtalkforums.com/showthread.php?p=59973)
 *  [Amit Mandaliya](https://wordpress.org/support/users/asony999/)
 * (@asony999)
 * [18 years, 7 months ago](https://wordpress.org/support/topic/problem-with-multiple-loops-on-singlephp-advice-needed/#post-590631)
 * Hello,
 * I have same problem. My problem isn’t solved by reading the above blog.
 * is there any solutions ?
 * Thanks.

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

The topic ‘Problem with multiple loops on single.php – advice needed’ is closed 
to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [multiple loops](https://wordpress.org/support/topic-tag/multiple-loops/)
 * [single.php](https://wordpress.org/support/topic-tag/single-php/)

 * 2 replies
 * 3 participants
 * Last reply from: [Amit Mandaliya](https://wordpress.org/support/users/asony999/)
 * Last activity: [18 years, 7 months ago](https://wordpress.org/support/topic/problem-with-multiple-loops-on-singlephp-advice-needed/#post-590631)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
