This tutorial will teach new wordpress users on how to add Google ads (or any other ad) within a post/article – at least in a way you don’t have to manually paste the ad code within the article (especially if you have 300+articles!); it would automatically paste the ad after the first paragraph (or however many paragraphs you like).

Step 1: Go to theme editor and open your theme’s single.php file – look for code that looks something like this:

<?php the_content(); ?>

Step 2: Now replace that code with the following code below:

<?php
$paragraphAfter= 1; //display after the first paragraph
$content = apply_filters(‘the_content’, get_the_content());
$content = explode(“</p>”, $content);
for ($i = 0; $i <count($content); $i ) {
if ($i == $paragraphAfter) { ?>

<div>Your Text / Ads Go Here</div>

<?php }
echo $content[$i] . “</p>”;
} ?>

You can change the number of paragraphs by changing the “$paragraphAfter” line, by changing the number “1″ to whatever number paragraph you like the ad to appear.