problem using -do not duplicate-
Below is the code with the standard template stuff at the top removed to shorten it. I had a table displaying two rows of three posts each, but both rows were the same. When I added the 'do not duplicate' parts the second row dissapeared (and I do have 6 posts in the category).Can anyone see where I went wrong? Soprry only on local server so no live example.
- Code:
get_header(); ?> <div style="margin:0 auto;"> <table style="text-align:left; width:100%; margin-left:0px auto; margin-right:0px auto;" border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <td style="width:33%;"> <?php $accordion1 = new WP_Query('category_name=AccordionPg1&showposts=3'); while($accordion1->have_posts()) : $accordion1->the_post(); $do_not_duplicate[] =$post->ID ?> <h3><?php the_title(); ?></h3> <?php the_content(); ?> </td> <td style="width:33%;" align="undefined" valign="undefined"> <?php endwhile; ?> </td></tr> <tr><td style="width:33%;" align="undefined" valign="undefined"> <?php rewind_posts(); ?> <?php $accordion2 = new WP_Query('category_name=AccordionPg1&showposts=3'); while($accordion2->have_posts()) : $accordion2->the_post(); if (in_Array($post->ID, $do_not_duplicate)) continue; update_post_caches ($posts); ?> <h3><?php the_title(); ?></h3> <?php the_content(); ?> </td> <td style="width:33%;" align="undefined" valign="undefined"> <?php endwhile; ?> </td> <td style="width:33%;" align="undefined" valign="undefined"> </tbody> </table> </div> <?php get_footer(); ?>