• I’m have an issue with the archives section of my template. My template has 3 columns, in the first column I’m using this code:

    <?php query_posts('r_sortby=most_rated&r_orderby=desc&cat=special') ?>
    <?php while (have_posts()) : the_post(); ?>
               <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo get_settings('home'); ?>/wp-content/uploads/<?php $values = get_post_custom_values("thumb_image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" /></a>
    <?php endwhile; ?>

    Basically what this does is list the most rated posts in the special category in a grid thumbnail, something that until recently wasn’t possible with PostRatings :).

    The next column has this code:

    <?php if (have_posts()) : ?>
    	<?php while (have_posts()) : the_post(); ?>
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php echo get_settings('home'); ?>/wp-content/uploads/<?php $values = get_post_custom_values("thumb_image"); echo $values[0]; ?>" alt="<?php the_title(); ?>" /></a>
            <?php endwhile; endif; ?>

    It’s your basic loop code that pulls the latest post in a category. My issue is the first batch of code is causing the second batch of code to pull the same posts (top rated post in special category). So to break it down simply, I want the first batch of code in the first column to pull the most rated post, displaying it in a grid thumbnail, while the second batch of code in the second column continues to do what it’s suppose to do and that is to pull the latest post within it’s archived category in grid thumbnail fashion. I’m sure I’m breaking some kind of multiple loop by law here.

    Just to note I was thinking of using “if statements” and just query the second batch of codes, this works, but it only pulls the posts that were voted on in that category, whilst I want it to show the latest post within that category independent of the highest rated posts.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter Doobus

    (@doobus)

    Found the solution, if anyone else is having issues with this, use $temp_query, found in multiple loops example 2 here.

Viewing 1 replies (of 1 total)
  • The topic ‘Multiple Loops’ is closed to new replies.