WordPress tutorial to add ads between posts in the Home page or Category, archive page. You can add any kind of ad link Google Adsense ad, buy-sell ad, or affiliate ad.
You can also use Ad Inserter WordPress plugin to insert Ads anywhere on your blog.
First login to your WordPress Admin panel
Go to Appearance -> Editor.
Open index.php or loop.php.
Search and find this code or similar code.
<?php while (have_posts()) : the_post(); ?>
Add the following code above line.
<?php $count = 1; ?>
Next, find the code look like this
<?php endwhile; ?>
Add the following code above the line
<?php if ($count == 1) : ?> YOUR GOOGLE ADSENSE CODE HERE <?php endif; $count++; ?>
Replace the “YOUR GOOGLE ADSENSE CODE HERE” code with your ad code.
If you want to appear your ad after some post, change the code like this
Ex: after 4th post
<?php if ($count == 4) : ?> YOUR GOOGLE ADSENSE CODE HERE <?php endif; $count++; ?>
If you want to remove the unwanted yellow background in Adsense Ads,
Change the CSS rules of ins in your theme style.css.
ins { text-decoration: none; background: transparent; }
That’s all.