Forums

[resolved] Avoiding Duplicate Posts Query Issue (3 posts)

  1. jcalabro
    Member
    Posted 2 years ago #

    Hi all,

    I'm having a problem avoiding duplicate posts. It seems that my second query accounts for the post it's avoiding. So what's happening is that if i query showposts=4, it only show 3! Very annoying.

    Any ideas how i can fix this? Or another way of avoiding dups?

    '<div class="entry">

    <?php query_posts('cat=3,4,5&showposts=1'); $ids = array(); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $ids[] = get_the_ID(); ?>
    <div class="date"><?php the_date();?></div>

    <h1>"><?php the_title(); ?></h1>
    <?php the_excerpt(); ?>
    <div class="author">
    <?php if ( is_category('creative')) { echo '<div class="creative"></div>'; } ?>
    <!--Posted by <?php the_author(); ?>-->
    </div>

    <?php endwhile; ?>
    <?php else : ?>

    <p>Sorry, we are working on new posts as we speak! :)</p>

    <?php endif; ?>

    </div>

    <?php
    query_posts("showposts=4&cat=3,4,5,6");
    while (have_posts()) : the_post();
    if (!in_array($post->ID, $ids)) { ?>
    <h3>"><?php the_title(); ?></h3>
    <?php }
    endwhile; ?>'

  2. esmi
    Theme Diva & Mod
    Posted 2 years ago #

  3. jcalabro
    Member
    Posted 2 years ago #

    Ahh - Thanks a bunch!

Topic Closed

This topic has been closed to new replies.

About this Topic