Some week ago,we publish article on how to get google adsense approval in easy and confirm way. Today,we have come to reveal the simple way to add adsense code in the middle of posts. Boosting of revenue is relavant for every webmaster but placing of ads in specific areas converts wonderful impression and bags money in your pocket. . You don't need work hard just adding a code to your Wordpress template creates better way to Earn more money.
Before you do implement this trick first you need to template code and find "Functions.php" inside your theme folder.
Lets go straight to the point.
Sign into your Wordpress account.
On the wordpress Dashboard,click apperance and click on Editor
Click on Functions.php file
After successful opening theme copy the below code and add after php start tag.
function inject_ad_text_after_n_chars($content) {
// only do this if post is longer than 1000 characters
$enable_length = 2000;
// insert after the first </p> after 500 characters
$after_character = 1500;
if (is_single() && strlen($content) > $enable_length) {
$before_content = substr($content, 0, $after_character);
$after_content = substr($content, $after_character);
$after_content = explode(‘</p>’, $after_content);
$text = ‘
<!——AdSense Code here———->
‘;
array_splice($after_content, 1, 0, $text);
$after_content = implode(‘</p>’, $after_content);
return $before_content . $after_content;
}
else {
return $content;
}
}
add_filter(‘the_content’, ‘inject_ad_text_after_n_chars’);
Customization of the code.
Replace <!——AdSense Code here———-> with your Adsense code only highlighted part
The $enable_length = 2000; indicates that the Adsense Ads inserted if the post length exceeds this value and character for set location of unit in post.
We suggest the lenght value 2000 by default is best and character 1,200.
Hope this post helps you to choose the best one for your blog. Help Us share This on Facebook, Twitter and Google Plus.
0 comments:
Post a Comment