Displaying posts horizontally not working on one page

I’m displaying the 2 newest posts horizontally on my home page (own template design) which works just fine.

I’m displaying all of the posts on an ‘archive’ page, but on this page they are showing vertically for some reason?

I want 2 columns of posts next to each other, but what works on one page isn’t on this!

Here’s the code on ‘archive’


<?php if (have_posts()) : while (have_posts()) : the_post();  ?>    

<div class="twinposts" id="post-<?php the_ID(); ?>">

  $myposts = get_posts('');
  foreach($myposts as $post) :
  setup_postdata($post);			/* adds the content */
 <?php the_title('<h2>', '</h2>'); ?>
 <?php the_content(); ?>
 <?php endforeach; wp_reset_postdata(); ?>
  <div id="postedinfo">    
   <?php  edit_post_link(__('Edit', 'fizzblog'), '', ' | '); ?>      
</div>  <!-- twinposts --> 

<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

<div class="empty"></div>

Twinposts is floated left with a width of 46%.

Any ideas? It’s driving me slowly mad…

Put twin posts inside a container div, putting it inside content is insufficient.

I found that the solution was to use the same code for my ‘archive/history’ page but change:

[php] <?php query_posts('showposts=2'); ?>[/php]


[php]<?php query_posts('showposts'); ?>[/php]

Thus freeing up the constraint to two posts that I have added on my home page.


Sponsor our Newsletter | Privacy Policy | Terms of Service