I have a list of 29 posts, after the 1st i want to insert an advert (ad_unit 1), after the 9th i want to insert an advert (ad_unit 2), after the 18th i want to insert an advert (ad_unit 3) and after the 27th i want to insert an advert (ad_unit 4). I have come up with this code below but i can only display ad_unit 1 after 1st post then the rest of positions i get ad_unit 2. Thanks for your help
$t[’__loop’] = $t[’__loop’] + 1;
?>
<?= get_option('ad_unit_1'); ?>
<?php elseif ($t['__loop'] === 10) :
$t['__loop'] = 1;
?>
<?= get_option('ad_unit_2'); ?>
<?php endif; ?>