title: Wordpress posts repeating
body: <p>Hey guys I am using the Imbalance2 theme for WordPress and I have created a new loop to deal with a different page as I have got one category directing to a page, however the posts that are on the page when first loaded are just repeating as I scroll down the page. It is using an ajax thing to load on scroll. Below is my code for the new loop: </p>
  
  <pre><code>    &lt;?php if ( ! have_posts() ) : ?&gt;
      &lt;div id="post-0" class="post error404 not-found"&gt;
          &lt;h1 class="entry-title"&gt;&lt;?php _e( 'Not Found', 'imbalance2' ); ?&gt;&lt;/h1&gt;
          &lt;div class="entry-content"&gt;
              &lt;p&gt;&lt;?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'imbalance2' ); ?&gt;&lt;/p&gt;
              &lt;?php get_search_form(); ?&gt;
          &lt;/div&gt;&lt;!-- .entry-content --&gt;
      &lt;/div&gt;&lt;!-- #post-0 --&gt;
  &lt;?php endif; ?&gt;
  
  &lt;?php $imbalance2_theme_options = get_option('imbalance2_theme_options') ?&gt;
  
  &lt;div id="boxes"&gt;
  &lt;?php while ( have_posts() ) : the_post(); ?&gt;
  
      &lt;div class="box"&gt;
          &lt;div class="rel"&gt;
              &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_post_thumbnail('homepage-thumb', array('alt' =&gt; '', 'title' =&gt; '')) ?&gt;&lt;/a&gt;
      &lt;?php if ($imbalance2_theme_options['images_only'] == 0): ?&gt;
  
              &lt;h1 style="padding-top:8px; padding-bottom:2px;"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h1&gt;
          &lt;?php the_excerpt() ?&gt;
                      &lt;div class="categories" style="padding-top:5px;"&gt;&lt;?php
                      $key = 'title';
                      $themeta = get_post_meta($post-&gt;ID, $key, TRUE);
                      if($themeta != '') {
                          echo "&lt;strong&gt;Job Title: &lt;/strong&gt;";
                      echo $themeta;
                      }
                      ?&gt;
                      &lt;br /&gt;
                      &lt;?php
                      $key = 'location';
                      $themeta = get_post_meta($post-&gt;ID, $key, TRUE);
                      if($themeta != '') {
                          echo "&lt;strong&gt;Location: &lt;/strong&gt;";
                      echo $themeta;
                      }
                      ?&gt;
                      &lt;/div&gt;
              &lt;div class="posted"&gt;&lt;?php imbalance2_posted_on() ?&gt; &lt;span class="main_separator"&gt;/&lt;/span&gt;
                  &lt;?php echo comments_popup_link( __( 'No comments', 'imbalance2' ), __( 'One Comment', 'imbalance2' ), __( '% Comments', 'imbalance2' ) ); ?&gt;
              &lt;/div&gt;
      &lt;?php endif ?&gt;
              &lt;div class="texts"&gt;
      &lt;?php if ($imbalance2_theme_options['images_only'] == 1): ?&gt;
                  &lt;a class="transparent" href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_post_thumbnail('homepage-thumb', array('alt' =&gt; '', 'title' =&gt; '')) ?&gt;&lt;/a&gt;
      &lt;?php endif ?&gt;
                  &lt;div class="abs"&gt;
      &lt;?php if ($imbalance2_theme_options['images_only'] == 0): ?&gt;
                  &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_post_thumbnail('homepage-thumb', array('alt' =&gt; '', 'title' =&gt; '')) ?&gt;&lt;/a&gt;
      &lt;?php endif ?&gt;
  &lt;h1 style="padding-top:8px; padding-bottom:2px;"&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h1&gt;
          &lt;?php the_excerpt() ?&gt;
                      &lt;div class="categories" style="padding-top:5px;"&gt;&lt;?php
                      $key = 'title';
                      $themeta = get_post_meta($post-&gt;ID, $key, TRUE);
                      if($themeta != '') {
                          echo "&lt;strong&gt;Job Title:  &lt;/strong&gt;";
                      echo $themeta;
                      }
                      ?&gt;
                      &lt;br /&gt;
                      &lt;?php
                      $key = 'location';
                      $themeta = get_post_meta($post-&gt;ID, $key, TRUE);
                      if($themeta != '') {
                          echo "&lt;strong&gt;Location:  &lt;/strong&gt;";
                      echo $themeta;
                      }
                      ?&gt;
                      &lt;/div&gt;
          &lt;?php the_excerpt() ?&gt;
                      &lt;div class="posted"&gt;&lt;?php imbalance2_posted_on() ?&gt; &lt;span class="main_separator"&gt;/&lt;/span&gt;
                      &lt;?php echo comments_popup_link( __( 'No comments', 'imbalance2' ), __( 'One Comment', 'imbalance2' ), __( '% Comments', 'imbalance2' ) ); ?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;?php endwhile; ?&gt;
  &lt;/div&gt;
  
  &lt;?php if ( $wp_query-&gt;max_num_pages &gt; 1 ) :
      if ( $imbalance2_theme_options['navigation'] == 0 ) : // Default ?&gt;
  
  &lt;div class="fetch"&gt;
      &lt;?php next_posts_link( __( 'Load more posts', 'imbalance2' ) ); ?&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  // Ajax-fetching "Load more posts"
  $('.fetch a').live('click', function(e) {
      e.preventDefault();
      $(this).addClass('loading').text('Loading...');
      $.ajax({
          type: "GET",
          url: $(this).attr('href') + '#boxes',
          dataType: "html",
          success: function(out) {
              result = $(out).find('#boxes .box');
              nextlink = $(out).find('.fetch a').attr('href');
              $('#boxes').append(result).masonry('appended', result);
              $('.fetch a').removeClass('loading').text('Load more posts');
              if (nextlink != undefined) {
                  $('.fetch a').attr('href', nextlink);
              } else {
                  $('.fetch').remove();
              }
          }
      });
  });
  &lt;/script&gt;
  
      &lt;?php elseif ( $imbalance2_theme_options['navigation'] == 1 ) : // Infinite scroll ?&gt;
  
  &lt;div class="infinitescroll"&gt;
      &lt;?php next_posts_link( __( 'Load more posts', 'imbalance2' ) ); ?&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  // Infinite Scroll
  var href = 'first';
  $(document).ready(function() {
      $('#boxes').infinitescroll({
          navSelector : '.infinitescroll',
          nextSelector : '.infinitescroll a',
          itemSelector : '#boxes .box',
          loadingImg : '&lt;?php echo get_bloginfo('stylesheet_directory') ?&gt;/images/loading.gif',
          loadingText : 'Loading...',
          donetext : 'No more pages to load.',
          debug : false
      }, function(arrayOfNewElems) {
          $('#boxes').masonry('appended', $(arrayOfNewElems));
          if (href != $('.infinitescroll a').attr('href'))
          {
              href = $('.infinitescroll a').attr('href');
          }
      });
  });
  &lt;/script&gt;
  
      &lt;?php endif; ?&gt;
  
  &lt;?php endif; ?&gt;
  </code></pre>
  
  <p>Thanks for any help,
  Adam</p>