How to Set Adsense Ads Right Before The Last Paragraph

Google Adsense is one of the Best Ways to earn by showing ads in any standard website. If you have a lot of traffic in your site then your earn will touch the sky. Actually there is no limit to earn a lot by showing Adsense Ads in any site. So any one can earn unlimited dollar by using Adsense ads in a Google approved site. The best advantage of Adsense is if Google approve your site once then you can use your Adsense codes in 500 websites. This is really a great opportunity given by the Google authority. Where as if you want to use Bing or yahoo ads in your site then you have to approve every site manually by the Bing or yahoo authority. But in the case of Google you have to keep in mind that you can’t violate their terms and conditions.

Adsense Ads Right Before The Last Paragraph

Now let’s come to the point. As I am blogging since 2010 from that year I have tried to learn new tips and tricks. Many new bloggers tried to the best to approve their sites for Adsense. But after approving Adsense account by the google authority they want to set their Adsense ads in different places in a post. But for the want of coding knowledge they search a lot in google to get their right answers. Sometimes they get the answers but don’t understand the code. From that perspective I have written this post today.

Somebody asked me that How to Set Adsense Ads Right Before The Last Paragraph ? So let’s get the code. Copy the code and put this at the end of your functions.php file. N.B. Don’t forget to keep the back up of original functions.php file before adding the given code. You have to add Your Chosen Adsense Code by replacing Your Adsense Code text. It’s really very easy.

function ads_added_above_last_p($text) {
if( is_single() ) :
$ads_text = '<div class="a" style="text-align: center;">Your Adsense Code</div>';
if($pos1 =strrpos($text, '

')){
$text1 = substr($text, 0, $pos1);
$text2 = substr($text, $pos1);
$text = $text1 . $ads_text . $text2;
}
endif;
return $text;
}
add_filter('the_content', 'ads_added_above_last_p');

Necessity of this type of code:

Now you can ask me that you can also do it by using some famous plugins like easy Adsense or quick Adsense. The answer is there are a lot of bloggers or website owners who don’t want to use plugin to show Adsense ads. They always prefer simple code which I have given above. On the other hand all plugins are not coded perfectly . Only very few plugins can decrease your sites speed. But most of those increase your site’s loading speed. But the above given code will increase your site’s speed. So we should show Adsense ads by using standard above mentioned code. N.B. Don’t use the justify option for the last para of a post. Otherwise you will not see any Adsense ads right before the last paragraph of your post.

Check a Site’s Loading Time, HTML Errors and SEO

How to Load Your Site Fastly-(100% working)

It will always be better to use only compulsory plugins as they increase sites’ loading speed. Somebody says that you can use a lot of plugins. My question is to them that if this statement is true then why godaddy.com has created P3 Profiler Plugin to find out that which plugin is decreasing a sites speed. Perhaps you have got my answer. If you have any question or feedback then please leave you comment in the comment section. It will help this sites to take the right decision on How to Set Adsense Ads Right Before The Last Paragraph. Stay connected with eTunesCafe to get new IT Tips and Tricks by liking our Facebook Fan Page facebook.com/etunescafe and also follow in Twitter.

7 Comments

  1. Toufiq Hassan Shawon February 16, 2015
  2. habib @ bangla sms February 13, 2016
  3. uk email lists June 14, 2016
  4. Sarah Jones July 16, 2016
  5. Golam Qauser August 29, 2016
  6. Alex Rook June 6, 2017

Leave a Reply