logo

This is an old version of this answer!

Return to the current answer
Are you intentionally nesting one loop inside the other? Doing so and calling the_post() will overwrite the values of the outer loop with those of the inner loop, leaving them there even after the inner loop is 'closed'

from looking at your code, have you tried the following?
<?php
/*
Template Name: New Builds with no Slideshow
*/
?>
<?php get_header(); ?>
<div class="clear"></div>

<div id="content">
<div id="left-content">
<h2>NEW BUILDS</h2>
<!--be sure to change cat=4 to whatever category Refits become-->
<ul class="sidebar">
<?php
$stored_query = $wp_query; // saving the natural WP query for the page to that we can return to it after we overwrite the globals with our new query
$recent = new WP_Query("cat=3&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>
<li><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

</div>
<div id="right-content">
<?php
$wp_query = $stored_query; //bring back all the original data for the 'natural' loop
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $picture = get_post_meta($post->ID, 'picture', true); ?>
<div id="slide-gallary">
<img src="<?php echo $picture; ?>" align="left" alt="<?php the_title(); ?>" width="440" height="280" /><br class="clear" />
</div>
<div id="colm-3">

<h1><?php the_title(); ?></h1>
<?php the_content(); ?>


</div>

<div class="clear"></div>
<?php endwhile; ?>


<?php endif; ?>
</div>

</div>
<div class="clear"></div>


<?php get_footer(); ?>


Effectively running your first loop to generate your category lists, then returning to the 'natural' loop for the page content.

neil_pie | 02/07/10 at 5:07am

This is an old version of this answer!

Return to the current answer