title: Output recent Wordpress posts in tables, 2 posts wrapped in tr tag?
body: <p>I'm designing a custom wordpress theme where I'd like to display the recent posts on the home page horizontally in tables, two posts per row. It would look like this:</p>
  
  <p><a href="http://www.numenfilm.com/preview/issues.php" rel="nofollow noreferrer">http://www.numenfilm.com/preview/issues.php</a></p>
  
  <p>So I'd like my index.php file to kick out code like this:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
        &lt;td&gt;
          post contents here
        &lt;/td&gt;
        &lt;td&gt;
          post contents here
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;
          post contents here
        &lt;/td&gt;
        &lt;td&gt;
          post contents here
        &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The table and td tags are easy. The problem I've having is getting the tr tags to wrap around the posts in groups of two.</p>
  
  <p>I found this post elsewhere on stack overflow:</p>
  
  <p><a href="https://stackoverflow.com/questions/7341371/table-tr-each-2-loop-php-html">Table, TR each 2 loop, PHP, HTML</a></p>
  
  <p>The last suggestion seems to be what I'm looking for, but I haven't had any luck integrating it with wordpress.  Here's the code from my index.php page:</p>
  
  <pre><code>&lt;?php get_header(); ?&gt;
    &lt;div id="main_content"&gt;
    &lt;h1&gt;&lt;a href="&lt;?php echo get_settings('home'); ?&gt;"&gt;Numen News &amp;amp; Blog&lt;/a&gt;&lt;/h1&gt;
      &lt;?php
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("showposts=5&amp;paged=$paged");
      ?&gt;
  
        &lt;?php if (!is_single() &amp;&amp; !is_page() &amp;&amp; !is_front_page()) : ?&gt;&lt;h1&gt;&lt;?php wp_title(' ', true, 'right'); ?&gt;&lt;/h1&gt;&lt;?php endif; ?&gt;
  
          &lt;?php /* begin the loop */ if (have_posts()) : ?&gt;
  
      &lt;?php while (have_posts()) : the_post(); ?&gt;
        &lt;?php if (is_page()) : /* show page contents */ ?&gt;
                  &lt;div class="pagecontent" id="post-&lt;?php the_ID(); ?&gt;"&gt;
                      &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
                      &lt;?php the_content('Read more &amp;rarr;'); ?&gt; 
                      &lt;p&gt;&lt;?php wp_link_pages('next_or_number=number&amp;pagelink=page %'); ?&gt;&lt;/p&gt;
                      &lt;p&gt;&lt;?php edit_post_link('Edit', '[ ', ' ]'); ?&gt;&lt;/p&gt;  
                  &lt;/div&gt;
                  &lt;?php comments_template(); ?&gt;
  
              &lt;?php else : /* show post contents */ ?&gt;
                  &lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt;
                      &lt;div class="postcontents"&gt;
                          &lt;?php if (!is_single()) : ?&gt;
                              &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
                          &lt;?php else : ?&gt;
                              &lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;
                          &lt;?php endif; ?&gt;
  
              &lt;div class="posted"&gt;Posted &lt;?php the_time('F jS, Y') ?&gt; by &lt;?php the_author_link(); ?&gt; &lt;/div&gt;
                          &lt;?php the_content('Read more &amp;rarr;'); ?&gt; 
                          &lt;p&gt;&lt;?php wp_link_pages('next_or_number=number&amp;pagelink=page %'); ?&gt;&lt;/p&gt;    
                      &lt;/div&gt;
  
                      &lt;?php if(is_single) comments_template(); ?&gt;
                  &lt;/div&gt;
              &lt;?php endif; /* end if page or post */ ?&gt;
          &lt;?php endwhile;/* end the main loop */ ?&gt;
  
          &lt;?php /* post navigation */ ?&gt;
          &lt;?php if (is_single()) : ?&gt;
              &lt;div class="postnavigation"&gt;
                  &lt;?php previous_post_link('%link', '&lt;span&gt;&amp;larr;&lt;/span&gt; Previous post') ?&gt;
                  &lt;?php next_post_link('%link', 'Next post &lt;span&gt;&amp;rarr;&lt;/span&gt;') ?&gt;
              &lt;/div&gt;
          &lt;?php endif; ?&gt;
          &lt;?php if (  $wp_query-&gt;max_num_pages &gt; 1 ) : ?&gt;
              &lt;div class="postnavigation"&gt;
                  &lt;?php next_posts_link('Older posts &lt;span&gt;&amp;rarr;&lt;/span&gt;') ?&gt;  
                  &lt;?php previous_posts_link('&lt;span&gt;&amp;larr;&lt;/span&gt; Newer posts') ?&gt;
              &lt;/div&gt;
          &lt;?php endif; ?&gt;
          &lt;?php endif; /* end if have_posts */ ?&gt;      
    &lt;/div&gt;&lt;!--END main_content --&gt;
  &lt;?php /* sidebar */ get_sidebar(); ?&gt;
  &lt;?php /* footer */ get_footer(); ?&gt;
  </code></pre>
  
  <p>Any suggestions?</p>