WordPress.org

Ready to get started?Download WordPress

Forums

Avoiding Duplicate Posts using query_posts (2 posts)

  1. croco2511
    Member
    Posted 3 years ago #

    I have two custom fields, one is availability-ebook, the other availability-printbook. They are both set to 'Coming Soon' for books not published yet.

    On a Coming Soon page with custom template, I want to call all book pages set to 'Coming Soon' if the book's not published yet.
    How can I avoid duplicate posts because both the ebook and printbook availability are set to 'Coming Soon'.

    My query so far:

    <?php
    //The Query
    query_posts('post_type=page&order=ASC&orderby=date&meta_value=Coming Soon&posts_per_page=-1');
    
    //The Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();?>

    I know all about avoiding duplicate posts with two loops. However, if I do 2 loops, I can get the books to show up in the order of their release date, cause first it runs through one loop say for all print books, and in the second loop then for all ebooks.

    So how can I avoid duplicate posts running only 1 loop/query?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic