How to Insert Ads into Middle Part of Post Content

Read my yesterday post about How to Insert Ads into Upper Part of Post Content?

Do you know the ads on the middle part of the post content has very high conversion rate and can earn much better money than other ads? Today I will guide you on how to insert the ads into middle part of post content.

I belived if you’ve read and done my yesterday tutorial, you shouldn’t have any difficulties today. Come, here is the steps:

First, open your Administrator Control Panel –> Appearance –> Editor. On the right side of your editor, look for the content-single.php (default themes – twentyeleven, in my case).

Alternatively, you can login to your hosting control panel –> file manager –> look for the path /blog path/wp-content/themes/your current theme/content-single.php

Look for the following code:

<div class=”entry-content”>
<?php the_content(); ?>

And replace the <?php the_content(); ?> with this code:

$paragraphAfter= 4; //display after the first paragraph
$content = apply_filters(‘the_content’, get_the_content( __( ‘Read Full Story <span class=”meta-nav”>&rarr;</span>’, ‘RMvalues’ ) ));
$content = explode(“</p>”, $content);
for ($i = 0; $i <count($content); $i++ ) {
if ($i == $paragraphAfter) { ?>
<div>Your Google AdsenseAdBriteClicksorNuffnang7Search, or whatever ads or banner here</div>
<?php }
echo $content[$i] . “</p>”;
} ?>

By default, I set the ads to be inserted after the paragraph 4, if you want to change to paragraph 1, 2, 3 or whatever, you can change the following code:

$paragraphAfter= 4; (modify the 4 to whatever number you want)

Easy? Tomorrow I’ll guide you on inserting the ads on the bottom of the post content, don’t  forget to come again.

Today's Top Picks for Our Readers:

Leave your comment here: