Support » Themes and Templates » Problem with showposts

  • Resolved misterpatrick67


    Hello all,

    I am running two loops because I have some wacky CSS. In any case, there is something weird happening with my code. I need the first loop to show three unique posts and then the final loop to show just one unique post from the same category. It’s like I need some sort of limiter on the second loop. Here’s what I have:

    <?php $my_query = new WP_Query('category_name=News&showposts=4');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate[] = $post->ID ?>
        <!-- Do stuff... -->
      <?php endwhile; ?>
        <!-- Do other stuff... -->
    <?php if (have_posts()) : while (have_posts()) : the_post();
     if (in_array($post->ID, $do_not_duplicate)) continue;
     update_post_caches($posts); ?>
       <!-- Do stuff... -->
      <?php endwhile; endif; ?>


Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem with showposts’ is closed to new replies.