I am working on a site where I would like to add some ad code every 3rd or 4th post. It is a Masonry style blog with multiple post types. I know how to do the custimazation to make the ad fit in with the masonry; however, I don’t know where to insert the counter/ad code via this customized loop:
<?php $options = get_option('salient');
$blog_type = $options['blog_type'];
if($blog_type == null) $blog_type = 'std-blog-sidebar';
$masonry_class = null;
//enqueue masonry script if selected
if($blog_type == 'masonry-blog-sidebar' || $blog_type == 'masonry-blog-fullwidth' || $blog_type == 'masonry-blog-full-screen-width') {
$masonry_class = 'masonry';
}
if($blog_type == 'masonry-blog-full-screen-width') {
$masonry_class = 'masonry full-width-content';
}
if($blog_type == 'std-blog-sidebar' || $blog_type == 'masonry-blog-sidebar'){
echo '<div id="post-area" class="col span_9 '.$masonry_class.'">';
} else {
echo '<div id="post-area" class="col span_12 col_last '.$masonry_class.'">';
}
if(have_posts()) : while(have_posts()) : the_post(); ?>
Any help would be appreciated.