• 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?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Avoiding Duplicate Posts using query_posts’ is closed to new replies.