View difference between Paste ID: qkVL8UJV and 2WfX1jQH
SHOW: | | - or go back to the newest paste.
1-
<?php $ad_positions = array(1,2,4); // array of preset possible ad positions
1+
<?php $ad_positions = array(1,3,5); // array of preset possible ad positions
2
$ad_positions_2 = array(2,4,6); // array of preset possible ad positions
3-
do { $rnd_ad = $ad_positions[rand(0,count($ad_positions)-1)]; } while ($rnd_ad >= $wp_query->post_count); ?>
3+
4
do { $rnd_ad = $ad_positions[rand(0,count($ad_positions)-1)]; } while ($rnd_ad >= $wp_query->post_count); 
5
do { $rnd_ad_2 = $ad_positions_2[rand(0,count($ad_positions_2)-1)]; } while ($rnd_ad_2 >= $wp_query->post_count); ?>
6
7
<?php if(have_posts()) : while(have_posts()) : the_post(); // start of the loop // ?>
8
9
some possible post output here
10
11
<?php if( ($wp_query->current_post+1) == $rnd_ad ) : ?>
12
adsense code here
13
<?php endif; ?> 
14
<?php if( ($wp_query->current_post+1) == $rnd_ad_2 ) : ?>
15
adsense code 2 here
16
<?php endif; ?> 
17
18
more possible post output here
19
20
<?php endwhile; endif; // end of the loop // ?>