I’m trying to setup a Search Results page with two columns. First column will present results from all categories except one ( Galleries ), and the second column will present only the Galleries category.
query_posts()
simply resets my results. This is what I got so far. Broken:
<?php
$s = get_query_var('s');
query_posts('s=' . $s . '&cat=164');
?>
<?php
// First Loop
?>
<div class="contentLeft">
<ul class="postListSmall related">
<?php while (have_posts()) : the_post(); ?>
[do stuff]
<?php endwhile; ?>
<?php
// Second Loop
?>
<?php query_posts('cat=-164'); ?>
<?php rewind_posts(); ?>
<?php while (have_posts()) : the_post(); ?>
[do stuff]
<?php endwhile; ?>
<?php else : ?>
[do stuff]
<?php endif; ?>
What to do?
I know this is an old post but I am having a similar problem and thought I would share:
Then why are you calling the rewind function immediately after the new query? Also, if you’re resetting the results then why is it a different query completely? This:
Is not the same as this:
To get 2 column results for different categories I did the following: use only one loop, don’t use rewind, use get_the_category in an if statement in your loop, for example:
Hope this helps.