title: The <div> loops automatically and not able to control it
body: <p>Last time i had some problem in my code, by now i have fixed the problem but there is one more problem exixting.
  Here in my code, the main <code>&lt;div&gt;</code> automatically loops 5 times showing the same list of elements 5 timee. I am unable to find out what has caused the loop. On inspecting the element, i came to know that the main loop i.e. <code>&lt;div class="row-fluid"&gt;</code> loops for 5 times. Where is the problem and how can i solve it?
  Really need help.</p>
  
  <p>Thank u in advance.</p>
  
  <pre><code>&lt;?php if ($cat == 2900) { ?&gt;
    &lt;div class="row-fluid"&gt;
     &lt;div class="span12 featured-block"&gt; 
      &lt;?php $block1Featured= new WP_Query( 'cat=2900' );
       if ( $block1Featured-&gt;have_posts() ) : ?&gt;
        &lt;?php while($block1Featured-&gt;have_posts()): $block1Featured-&gt;the_post(); ?&gt;
          &lt;div class="span6 "&gt;
          &lt;a class="featured_image" href="&lt;?php the_permalink();?&gt; "target="_blank"&gt;
           &lt;?php if ((function_exists('has_post_thumbnail')) &amp;&amp; (has_post_thumbnail())  ) { 
             $image_id = get_post_thumbnail_id(); 
             $image_url = wp_get_attachment_image_src($image_id,'large');
             $image_url = $image_url[0];
             if(!@getimagesize($image_url)){
             $image_url = "/wp-content/uploads/2014/02/logo2.jpg";
             } 
             $blogurl = get_bloginfo('url'); 
             $image_url = str_replace($blogurl, '', $image_url);
            ?&gt;
  
             &lt;img src="&lt;?php echo bloginfo('template_url'); ?&gt;/thumb.php?src=&lt;?php echo ($image_url); ?&gt;&amp;amp;w=390&amp;amp;h=216&amp;amp;zc=1&amp;amp;q=100" alt="&lt;?php echo the_title(); ?&gt;" /&gt;
  
           &lt;?php }else{ ?&gt; 
  
  
             &lt;img src="&lt;?php echo bloginfo('template_url'); ?&gt;/thumb.php?src=&lt;?php echo "http://www.nepaljapan.com/wp-content/uploads/2014/02/logo2.jpg"; ?&gt;&amp;amp;w=390&amp;amp;h=216&amp;amp;zc=1&amp;amp;q=100" alt="&lt;?php echo the_title(); ?&gt;" /&gt;
  
  
           &lt;?php }?&gt;
          &lt;/a&gt;
  
      &lt;a href="&lt;?php the_permalink();?&gt;" target="_blank"&gt;
      &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;&lt;/a&gt;
      &lt;p&gt;&lt;?php echo excerpt(37); ?&gt; &lt;/p&gt;
      &lt;/div&gt;
      &lt;?php endwhile; ?&gt;
  
      &lt;?php wp_reset_postdata(); ?&gt;
  &lt;?php else:  ?&gt;
  &lt;p&gt;&lt;?php _e( 'Sorry, no posts matched your criteria.' ); ?&gt;&lt;/p&gt;
  &lt;?php endif; ?&gt;
  
    &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;?php } ?&gt;
  
  &lt;?php }else{ ?&gt;
  //else contents
  &lt;?php } ?&gt;
  </code></pre>