Home » Just Blogging » How to Add google AdSense code inside post using wordpress Shortcode

The following code will allow you Add google AdSense code inside post using wordpress Shortcode which display a 468×60 AdSense unit wherever you place the [adsense] shortcode

function showads() {
return '<script type="text/javascript"><!--
google_ad_client = "pub-YOUR_PUB_ID_HERE";
google_ad_slot = "YOUR_ADD_SLOT_HERE";
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');

Note: Be sure to fill in your publisher ID and Ad Slot info. You can also use a different size ad by changing the width and height values.
Source: WP Recipes

Array ( [0] => Just Blogging )