Running 2 loops, very cool
I’ve set up a very cool projects Page that is using 2 separate loops. Well it will be extremely cool when I get it working properly…
Up top, in my header, I have a post selector that allows the user to scroll through a line of thumbnails (posts) from just the projects category. Using query_posts, I have this feature working perfectly.
<?php query_posts('post_type=post&order=asc&category_name=Projects'); ?> <div id="page"> <div id="slider"> <div class="scrollButtons scrollMeLeft"><a><span>previous</span></a></div> <div class="scroll"> <div class="scrollContainer"> <?php while (have_posts()) : the_post(); ?> <div class="panel" id="<?=$post->post_name?>"> <a href="<?php the_permalink() ?>"> <?php the_excerpt_rss(); ?> </a> </div> <?php endwhile;?> </div> </div> <div class="scrollButtons scrollMeRight"><a><span>next</span></a></div> </div> </div>
Down in the body of the page, I’m treating it just like any other single post page, but with the selector still in the header.
The problem I’m having is that when the 2nd loop runs, it’s pulling all the posts from the selector, and not just the single post that was selected. How can I set the second loop to run a new query as if it is a single post?
- The topic ‘Running 2 loops, very cool’ is closed to new replies.