Support » Fixing WordPress » Custom query problem

  • Boris


    I have a small problem with a custom query. here’s the code I have so far:

    <?php $recentPosts = new WP_Query();
    while ($recentPosts->have_posts()) : $recentPosts->the_post();
    $no_duplicate_recentPosts = $post->ID; ?>
    <!-- do stuff -->
    <?php endwhile; ?>

    Now my question, how I have to adjust the

    $no_duplicate_recentPosts = $post->ID;

    so the constant includes all 6 posts from the query above?
    Later I basically want to display the next 4 posts from the same 2 categories in a separate loop, obviously without those first 6 posts with this code:

    <?php $recentPosts2 = new WP_Query();
    while ($recentPosts2->have_posts()) : $recentPosts2->the_post();
    if($post->ID == $no_duplicate_recentPosts) continue; update_post_caches($posts); ?>
    <!-- do stuff -->
    <?php endwhile; ?>

    Thanks a lot…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom query problem’ is closed to new replies.