Title: Multiple loop creates CSS problem
Last modified: August 18, 2016

---

# Multiple loop creates CSS problem

 *  [Nienke](https://wordpress.org/support/users/nienke/)
 * (@nienke)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/multiple-loop-creates-css-problem/)
 * Hey,
 * I’m using a multiple loop in my index.php page which I copied from [here](http://wordpress.pastebin.ca/269401).
   It works like I want it to but it creates a CSS problem.
 * My website is set up like this: [link to image](http://i113.photobucket.com/albums/n237/millburray/blog.jpg)
 * At least, that’s how I want it to be! Right now the third latest blog is not 
   in a CSS selector which makes it all ugly. I have no idea how I put that third
   blog in a `<div>`.
 * Here’s my code:
 *     ```
       <?php get_header(); ?>
       <div id="container">
   
       <div id="blog">
   
             <?php $top_query = new WP_Query('cat=3&showposts=1'); ?>
             <?php while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID; ?>
   
             <div class="subject" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></div>
   
             		<?php the_content(); ?>
   
       <div class="meta"><a href="http://www.wakeupsleepyhead.org/about">Nienke</a> | Posted: <?php the_date('F jS, Y'); ?> | <?php the_category(', '); ?> |  <?php comments_popup_link('No Comments', 'One Comment', '% Comments'); ?></div>
   
             <?php comments_template(); // Get wp-comments.php template ?>
             <?php endwhile; ?>
             <br />
   
       <div class="recent">
       <div class="recentpost_left">
               <?php query_posts('showposts=3'); ?>
               <?php while(have_posts()) : the_post(); if(!($first_post == $post->ID)) : ?>
   
                   	 <div class="subject" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
                 <div class="meta"><a href="http://www.wakeupsleepyhead.org/about">Nienke</a> | Posted: <?php the_date('F jS, Y'); ?> | <?php the_category(', '); ?> |  <?php comments_popup_link('No Comments', 'One Comment', '% Comments'); ?> </div>
   
                   		<?php the_excerpt(); ?>
   
                               <?php wp_link_pages(); ?>
                               <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'), 'commentlink'); ?>
   
                   <?php comments_template(); // Get wp-comments.php template ?>
   
                   </div> <!--div post ends-->
   
               <?php endif; endwhile; ?>
       ```
   
 * So basically, my question is: how do I put that 3rd post in a <div> class. I 
   know this is vague, English isn’t my first language and I don’t know much about
   CSS and PHP.

The topic ‘Multiple loop creates CSS problem’ is closed to new replies.

## Tags

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

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 0 replies
 * 1 participant
 * Last reply from: [Nienke](https://wordpress.org/support/users/nienke/)
 * Last activity: [19 years, 3 months ago](https://wordpress.org/support/topic/multiple-loop-creates-css-problem/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
