Duplicating posts even with do_not_duplicate
-
Hey guys, I have big problem and I’m looking for solution almost a week.
I have my wordpress page and i want to display two types of posts. featured, 5 normals, featured and 20 normal posts.
<?php $my_query = new WP_Query('showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?> <div class="featured <?php sandbox_post_class() ?>" > <?php include (TEMPLATEPATH . '/post-image.php'); ?> <div class="bigdate"><?php the_time('d.m'); ?></div> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="post-content"><?php the_title() ?><span class="post-content-excerpt"><?php the_excerpt(); ?></span></a> </div><!-- .featured --> <?php endwhile; ?> <div class="recent"> <?php query_posts('showposts=5'); ?> <?php while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>"> <?php include (TEMPLATEPATH . '/post-image.php'); ?> <div class="bigdate"><?php the_time('d.m'); ?></div> <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>" class="post-content"><?php the_title() ?><span class="post-content-excerpt"><?php the_excerpt(); ?></span></a> </div><!-- .post --> <?php endwhile ?>
But when I’m putting code (featured with showposts=1) after second while, it’s looking good, but with duplicated posts from featured.
How to fix it, that featured will be using second post, not the same from previous while?
Any idea to sove it? ??
Thank you so much
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Duplicating posts even with do_not_duplicate’ is closed to new replies.