Advertisements after first post in WordPress
Here is a simple way to put an AdSense ad, or any other ad for that matter, after the first post in your WordPress blog. This will only work on your main page, not on an individual post page.
Okay, let’s get started. Open up your index.php file or go into the WordPress control panel > Presentation > Theme Editor and choose Main Index Template on the right
Find the line that starts with:
<?php if (have_posts())
Add this line of code above it:
<?php $count = 1; ?>
Find the line that starts with:
<?php the_content
Add this code below its closing tag:
<?php if ($count == 1) : ?>
Your Google AdSense code
<?php endif; $count++; ?>
Upload and update everything and see so everything works. You can easily customize this spot using CSS. You can also publish the advertisement after the second post or the third etc. Just change:
“count == 1? to “count == 2?
Get paid to review this post: Earn $7.50 by making a review about this post on your own blog. Click here for more information!
