Show Adsense Ad Anywhere in Your Post or Page Content

Sometimes the best place for an adsense ad unit to get maximum clicks is inside the post content.

It may seem that its very difficult to add an adsense ad unit anywhere in the post or page content but actually its quite easy.

First decide which ad you want to display inside the post content. The best ad for this purpose would be a 300px by 250px ad. But it all depends upon the layout of your theme. Once you have the code for the desired ad unit, add this code to the functions.php file of your theme,

function showads() {
    return '<script type="text/javascript"><!--
google_ad_client = "pub-3637220125174754";
google_ad_slot = "4668915978";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
'
;
}
add_shortcode('adsense', 'showads');

Don’t forget to change the adsense ad unit code to your code before pasting it in the functions.php file.

That’s it. Now you are ready to show this adsense ad anywhere in the content of a post or page. Just paste the shortcode [adsense] wherever you want to show this ad.

Thoughts?

Post your comment here...