Hey all. I'm having a bit of trouble getting my loops to work the right way...basically what I'm trying to do is have two loops - one that will show the x number of recent posts as specified in the WP options panel, and another that will show the latest 15 posts from a specific category, in this case called products. I have followed the codex instructions and can't seem to figure out what exactly is wrong and why the posts are still be duplicated. See my loop code below.
<div class="news">
<?php if (have_posts()) : while (have_posts()) : the_post();
if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
<!-- Post Stuff -->
<?php endwhile; endif; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
</div>
<div class="products">
<?php $i = 0; // Create a new (incrementing) var ?>
<?php $my_query = new WP_Query('category_name=products&showposts=15');
while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; // check for product large image
$pli = get_post_meta($post->ID, 'pli', $single = true); // check for item price
$price = get_post_meta($post->ID, 'price', $single = true); ?>
<?php $i++; // Increase count ?>
<!-- Post Stuff -->
<?php if ($i % 3 == 0): // if the result of the incrementing var is equal to zero ?>
<div class="spacer"></div>
<?php endif; ?>
<?php endwhile; ?>
</div>
The incrementing var stuff is used to display posts the right way in a grid format. I removed additional display code from the above code sample.
Any help would be greatly appreciated!
Thanks in advance!!