title: add pagination to "for each" loop in wordpress
body: <p>Im just wondering is it possible to use the <code>pagination_links()</code> function in a <code>foreach</code> loop in wordpress?
  When I try it nothing happens, I have looked around and it seems this is a little trickier than I was expecting...</p>
  
  <pre><code>&lt;?php
  $args = array( 'numberposts' =&gt; 6, 'post_status'=&gt;"publish",'post_type'=&gt;"post",'orderby'=&gt;"post_date");
  $postslist = get_posts( $args );
  foreach ($postslist as $post) : setup_postdata($post); ?&gt;
     &lt;div class="events"&gt;
          &lt;div class="newslistingblock"&gt;
          &lt;div class="newslistingblockheader"&gt;&lt;p&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="newslistingblockthumbnail"&gt;
           &lt;?php echo get_the_post_thumbnail( $post_id, 'news-thumb', $attr ); ?&gt; &lt;/div&gt;
           &lt;div class="newslistingexcerpt"&gt;
                  &lt;?php the_excerpt( ); ?&gt; &lt;/div&gt; 
    &lt;/div&gt;
    &lt;/div&gt;
  
  
  
  &lt;?php endforeach; ?&gt;
  </code></pre>
  
  <p>Im basically looking for basic pagination, with "next", "prev" and numbers.</p>
  
  <p>Any help on this would be great thanks.</p>
  
  <p>EDIT:
  I have decided to change the code to this to suit wordpress...</p>
  
  <pre><code>    &lt;?php 
  query_posts( 'posts_per_page=5' );
  if (have_posts()) : 
  
  while (have_posts()) : the_post(); ?&gt;
  &lt;!-- Do suff --&gt;
  
     &lt;div class="events"&gt;
          &lt;div class="newslistingblock"&gt;
          &lt;div class="newslistingblockheader"&gt;&lt;p&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
          &lt;div class="newslistingblockthumbnail"&gt;
           &lt;?php echo get_the_post_thumbnail( $post_id, 'news-thumb', $attr ); ?&gt; &lt;/div&gt;
           &lt;div class="newslistingexcerpt"&gt;
                  &lt;?php the_excerpt( ); ?&gt; &lt;/div&gt; 
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;?php endwhile; ?&gt; 
     &lt;div class="navigation"&gt;
      &lt;div class="alignleft"&gt;&lt;?php next_posts_link('← Older Entries') ?&gt;&lt;/div&gt;
      &lt;div class="alignright"&gt;&lt;?php previous_posts_link('Newer Entries →') ?&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php endif; ?&gt;
  </code></pre>