Custom query problem (2 posts)

  1. Boris
    Posted 8 years ago #

    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...

  2. Boris
    Posted 8 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic