I know it is little easy but unable to solve the issue with wordpress while loop. I am using zurb framework and for product list using below html structure.

```
<div class="row">
    <div class="four columns">
        item here
    </div>
    <div class="four columns">
        item here
    </div>
    <div class="four columns">
        item here
    </div>
</div>

```

So in while loop I want to repeat entire structure after every three four columns div. I have tried with below code

```
    <?php
        $temp = $wp_query;
        $wp_query = null;
        $wp_query = new WP_Query();
        $wp_query->query('post_type=product' . '&paged=' . $paged .'');
    ?>

    <?php $counter = 0;

    if ( have_posts() ) : while ( have_posts() ) : the_post();
        if ($counter % 3 == 0):
        echo '<div class="row"><!--row starts here-->';
        endif; ?>

        <div class="four columns">
            <article>

                <header>
                    <hgroup>
                        <h2><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'foundation' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
                        <h6>Written by <?php the_author_link(); ?> on <?php the_time(get_option('date_format')); ?></h6>
                    </hgroup>
                </header>

                <?php if ( has_post_thumbnail()) : ?>
                <a href="<?php the_permalink(); ?>" class="th" title="<?php the_title_attribute(); ?>" ><?php the_post_thumbnail(); ?></a>
                <?php endif; ?>

                <?php the_excerpt(); ?>

            </article>

        </div>

        <?php endwhile; ?>

    <?php else : ?>

        <h2><?php _e('No posts.', 'foundation' ); ?></h2>
        <p class="lead"><?php _e('Sorry about this, I couldn\'t seem to find what you were looking for.', 'foundation' ); ?></p>

    <?php endif;

    if ($counter % 3 == 0):
        echo '</div><!--row end here-->';
    endif; ?>

    <?php foundation_pagination(); ?>

</div>
<!-- End Main Content -->

```

But it is repeating wrongly and for every loop. I know this is obvious to repeat but the solution I unable to found how to repeat after only 3 four columns and in first loop row should div should be inserted as well.

Thanks a lot