Thursday, November 28, 2013

Enable Adsense Shortcode

Adsense is one of the most popular ad elements used by bloggers. Theme designers can place the adsense box in one spot which limits the users. If you want to give your client the ability to add the adsense anywhere, then you can create a shortcode for the adsense using this function:


function showads()

return ‘<div id=”adsense”><script type=”text/javascript”><!–

google_ad_client = “pub-XXXXXXXXXXXXXX”;

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></div>’;


add_shortcode(‘adsense’, ‘showads’);



Enable Adsense Shortcode

No comments:

Post a Comment

Please mention your comments.......