Thank you for your reply!!
Looks good!, but it doesn't work.
I tested it, and I even added a rewind_posts() function and nothing.
(There was an extra <?php }?> in this script)
Both queries show the same content: the page.
See it at http://seosumo.com/test (that's the only page that loads your script)
The code goes as follow:
<?php
/*
Template Name: Pages2
*/
?>
<?php get_header(); ?>
<div id="mainContent" class="showtab1">
<div id="maincontent1">
<h2 class="maintabs">
<big><b>Sumo</b></big>
<small><a href="javascript:void(0);" onclick="switch_main(2)">Latest Articles</a></small>
<small><a href="javascript:void(0);" onclick="switch_main(3)">SEO Tools</a></small>
</h2>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="entry" id="post-<?php the_ID(); ?>">
<h1 class="typeface-js"><?php the_title(); ?></h1>
<?php the_content(__('(more...)')); ?>
<?php endwhile; else: ?>
<div class="entry">
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<!-- end #entry --></div>
<div class="footer"><hr /></div>
</div>
<div id="maincontent2">
<h2 class="maintabs">
<small><a href="javascript:void(0);" onclick="switch_main(1)">Sumo</a></small>
<big><b>Latest Articles</b></big>
<small><a href="javascript:void(0);" onclick="switch_main(3)">SEO Tools</a></small>
</h2>
<?php // this is where the categories get cycled through and the latest X posts of each are displayed
$categories = $wpdb->get_results("SELECT $wpdb->terms.term_id AS id, name, description, term_order from $wpdb->terms INNER JOIN $wpdb->term_taxonomy ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id WHERE taxonomy = 'category' AND parent = 0 ORDER BY term_order ASC");
foreach ($categories as $category) { ?>
<?php rewind_posts(); query_posts('category_name='.$category->name.'&showposts=1'); } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="entry multipost" id="post-<?php the_ID(); ?>">
<?php the_date('','<span class="postinfo">','</span>'); ?>
<div class="postheader">
<span class="postinfo"><?php the_date('','<h2>','</h2>'); ?></span>
<h1 class="typeface-js"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
<span class="postinfo"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — Posted by <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></span>
</div>
<?php the_content(__('(more...)')); ?>
<?php link_pages('<p class="pagenavigator"> ', '</p>', 'next', ' next page', 'previous page '); ?>
<div class="postfooter postinfo"><?php the_tags(__('Tags: '), ', ', ' — '); ?></div>
<?php if (is_single()) : ?>
<div class="footer"><hr /></div>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endif; ?>
<!-- end Entry --></div>
<?php endwhile; else: ?>
<div class="entry">
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<!-- end Entry --></div>
<?php endif; ?>
<div class="footer"><hr /></div>
<?php posts_nav_link(' — ', __('« Newer Posts'), __('Older Posts »')); ?>
<!-- maincontent2 --></div>
<div id="maincontent3">
<h2 class="maintabs">
<small><a href="javascript:void(0);" onclick="switch_main(1)">Sumo</a></small>
<small><a href="javascript:void(0);" onclick="switch_main(2)">Articles</a></small>
<big><b>SEO Tools</b></big>
</h2>
<div class="entry">
<h1>Content 3 title</h1>
<p>This page is under construction and it will be up soon.</p>
<!-- end Content 3 --></div>
<div class="footer"><hr /></div>
<!-- end Content3 --></div>
<!-- end mainContent --> </div>
<?php include(TEMPLATEPATH.'/sidebars.php'); ?>
<br class="clearfloat" />
<!-- end #maincontainer --></div>
<?php get_footer(); ?>