1. <?php if ( have_posts() ) : $count = 0; ?>
  2.  
  3.     <div id="loop" class="<?php if ($_COOKIE['mode'] == 'grid') echo 'grid'; else echo 'list'; ?> clear">
  4. <center><?php echo adrotate_ad(12); ?></center>
  5.     <?php while ( have_posts() ) : the_post(); ?>
  6.  
  7.         <div <?php post_class('post clear'); ?> id="post_<?php the_ID(); ?>">
  8.             <?php if ( has_post_thumbnail() ) :?>
  9.             <a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
  10.                         'alt'   => trim(strip_tags( $post->post_title )),
  11.                         'title' => trim(strip_tags( $post->post_title )),
  12.                     )); ?></a>
  13.             <?php endif; ?>
  14.  
  15.             <div class="post-category"><?php the_category(' / '); ?></div>
  16.             <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
  17.  
  18.             <div class="post-meta">by <span class="post-author"><a
  19.                     href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>" title="Posts by <?php the_author(); ?>"><?php the_author(); ?></a></span>
  20.                                    on <span
  21.                         class="post-date"><?php the_time(__('M j, Y')) ?></span> <em>&bull; </em><?php comments_popup_link(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed')); ?> <?php edit_post_link( __( 'Edit entry'), '<em>&bull; </em>'); ?>
  22.             </div>
  23.             <div class="post-content"><?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 55); ?></div>
  24.         </div>
  25. <center><?php
  26. if ( have_posts() ) : while ( have_posts() ) : the_post();
  27.     //before
  28.     if ($count == 2){
  29.     echo adrotate_ad(10);
  30.     }
  31.     if ($count == 3){
  32.     echo adrotate_ad(29);
  33.     }
  34.     $count++;
  35.     //after
  36.   endwhile;
  37. endif;
  38. ?></center>
  39.  
  40.   <?php endwhile; ?>
  41.     </div>
  42.  
  43. <?php endif; ?>