I am using the following code in content.php to repeat an ad insertion. Ads are inserted in the middle of every 2nd row in a grid of thumbnails. There are 3 thumbnails per row.
<?php else : ?>
<?php global $wp_query; ?>
<?php if (($wp_query->current_post + 1) % 5 == 0 ): ?>
<div class="box">
<adsense code>
</div>
<?php endif; ?>
However Google's AdSense policy limits 3 content ads per page and I don't want to violate these terms. How can I limit this to only three instances? Thanks for your help.