Simple way to Embed Adsense Ad anywhere in the post

by Reeze on April 24, 2009

First, you have to add the following code to your function.php file. Don’t forget to change the adsense PUB(client) id in the Code.

function showads() {
return ‘<script type=”text/javascript”><!–
google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
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’);

Once you saved the functions.php file, you’re now able to embed your adsense code on your posts and display it exactly where you want. To do so, simply paste the following code on the editor, in html mode:

[adsense]

Related posts:

  1. Numbering comments in blogger
  2. Huge List of WordPress Codes / Hacks, Tricks
  3. Numbering Comments in WordPress
  4. Top 5 proven ways to boost your Alexa Rankings

Leave a Comment

Previous post:

Next post: