Bloggerdrug

Made Blogging Easy

  • Home
  • CONTACTS
  • ABOUT US
  • PRIVACY
  • Home
  • WORDPRESS
  • BLOGGER
  • SEO
  • EARN MONEY
  • SOCIAL MEDIA
    • FACEBOOK
    • TWITTER
    • GOOGLE+
  • WEB HOSTING
  • JOIN US
    • FACEBOOK
    • TWITTER
    • GOOGLE+

Friday, September 23, 2016

How to Add Adsense code in the Middle of Posts for Wordpress

 BloggerCampus     Friday, September 23, 2016     wordpress     No comments   

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.
Read Also: How to Get Your Site Indexed by Google Easily

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.

Like our facebook page here and follow us on twitter
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Popular Posts

  • Tested:How to Invest and Grow you Money by 40% in Naira in a Reliable and Sustainableable way
    FINALLY, THE LONG EXPECTED/AWAITED CMA HAS OFFICIALLY STARTED IN NIGERIA. CMA means Community Mutual Aid!!! In here we will tell yo...
  • Successful tips and tricks for promoting Blog, Website or Youtube videos
    To master your marketing skills for promoting blog or website or Youtube videos in this entrepreneur world for business, earn money onlin...
  • How to Add Adsense code in the Middle of Posts for Wordpress
    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...
  • How to Increase your money from your Account with 30%(Tested and confirm).
    Firstly,Is This Online  Business Real?yes,It is Real because I have personally Tested and Confirm it Myself.What you need to Know Are Lis...
  • 10 Easy Steps to Speed Up WordPress Blog & boost Performance
    No doubt That slow website reduce your pageview because your readers get irritating when site loads slower. Not you, not me, not anyone...
  • How to Successfully change Primary Email Address for blogger
    Few Blogger Beginners create their own blog with non related Email Address. After successful running of blog it is difficult to change th...
  • 8 Important Things To Do To Get Google Adsense Approval Easily
    All Bloggers want to get google adsense approval.YES,i said all Blogger because Google adsense is still the best way to moneti...
  • 5 Best Related Posts Plugins With Thumbnails For WordPress
    No doubt that there are some feature that is involved in wordpress that is missing in other blogging platform like blogger.When we ta...
  • How to Add Auto Scrolling sticky Bar to your Blog
    There is No doubt That Every Blogger wants Beautiful design for His/Her Blog,Scrolling sticky bar is one Of the design you need for your ...
  • How to Get Your Site Indexed by Google Easily
    Whenever you create a new blog, you always want your blog to get noticed by people easily. The best way people can find your blog is t...

Copyright © Bloggerdrug | Powered by Bloggerdrug
Design by potablenews | Blogger Theme by Naijasimple | Distributed By Bloggerdrug