Title: Help! Multiple Loops.
Last modified: August 20, 2016

---

# Help! Multiple Loops.

 *  [slamman](https://wordpress.org/support/users/slamman/)
 * (@slamman)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/help-multiple-loops/)
 * My site needs 4 individual posts on the front page. Each post is in its own “
   column”. I want to be able to control which posts are in each column by changing
   the $postid. I have created a widget to do all of this, my problem is solely 
   in getting the posts I want due to the way the “loop” works. Here is my html 
   for one of the columns to illustrate what I am trying to do. Each column is the
   same as this, I was just trying to change the $postid in the respective column
   to the post I wanted displayed there:
 *     ```
       <?php query_posts( 'p=$postid' );
       // the Loop
       while (have_posts()) : the_post();?>
       <div class="subFeature-thumb" >
       <img src="<?php echo get_stylesheet_directory_uri() ?>/scripts/timthumb.php?src=<?php echo PostThumbURL(); ?>&w=220&h=100&zc=1" alt="image" />
       </div>
       <div class="subFeature-link">
       <h3><a href="<?php the_permalink() ?>" title="Continue Reading <?php the_title(); ?>"><?php the_title(); ?></a></h3>
       </div>
       <div class="subFeature-byline">
       by <?php the_author() ?> on <?php the_date() ?>
       </div>
       <div class="subFeature-text">
       <?php arc_excerpt('arc_excerptlength_subFeature', 'arc_excerptmore'); ?>
       </div>
        <?php endwhile; ?>
       ```
   
 * Any help is greatly appreciated.

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

 *  [dheerajsl](https://wordpress.org/support/users/dheerajsl/)
 * (@dheerajsl)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/help-multiple-loops/#post-2286640)
 * Try removing the quotes <?php query_posts( ‘p=$postid’ );
 * or if that doesnt work try <?php query_posts( ‘p=”.$postid.”‘ );
 *  Thread Starter [slamman](https://wordpress.org/support/users/slamman/)
 * (@slamman)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/help-multiple-loops/#post-2286779)
 * Thanks for your suggestion, but it doesn’t work. I think I see where you are 
   going and I think it is the right track. Initially I thought there was a problem
   in the way I was using the loop, but thanks to your suggestion and further testing
   I believe there is a problem with passing the variable in this part:
 * <?php query_posts( ‘p=$postid’ );
 * My code is working and I am getting a post…or more correctly every post.
 * Prior to inserting the complete code I tested the rest of the code to make sure
   the variable was available by running this:
 * echo $postid;
 * This worked resulting in: 42
 * This broke the widget:
    <?php query_posts( p=$postid );
 * This resulted in no change to the original:
    <?php query_posts( ‘p=”.$postid.”‘);
 *  Thread Starter [slamman](https://wordpress.org/support/users/slamman/)
 * (@slamman)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/help-multiple-loops/#post-2286780)
 * Ok I figured this out. I changed the line in question to:
 * query_posts( ‘p=’. $postid );
 * makes perfect sense now that I think about about it.

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

The topic ‘Help! Multiple Loops.’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [slamman](https://wordpress.org/support/users/slamman/)
 * Last activity: [14 years, 9 months ago](https://wordpress.org/support/topic/help-multiple-loops/#post-2286780)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
