• Goal show table with 3 posts from cat:AccordionPg1 on row 1 and next 3 post on row 2. Before I added the do not duplicate code I had it right except second row contained the same three posts as the first. Now I only get one row of three posts. Sorry site not on internet.

    <?php
    /*
    Template Name: nosidebar3
    */
     ?>
    <?php // Do not delete these lines ?>
    <?php 	/* get all options: */
    # error_reporting(-1);
    include (TEMPLATEPATH . '/functions/bfa_get_options.php');
    global $bfa_ata;
    
    $left_col2 = "off";
    $left_col ="off";
    $right_col2 = "off";
    $right_col = "off";
    
    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(); ?>

The topic ‘problem with do not duplicate’ is closed to new replies.