Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php $ad_positions = array(1,2,4); // array of preset possible ad positions
- do { $rnd_ad = $ad_positions[rand(0,count($ad_positions)-1)]; } while ($rnd_ad >= $wp_query->post_count); ?>
- <?php if(have_posts()) : while(have_posts()) : the_post(); // start of the loop // ?>
- some possible post output here
- <?php if( ($wp_query->current_post+1) == $rnd_ad ) : ?>
- adsense code here
- <?php endif; ?>
- more possible post output here
- <?php endwhile; endif; // end of the loop // ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement