How to: Embed/Insert Google Adsense Ads on WordPress Posts

We can easily embed Google Adsense Ads on wordpress posts by editing the function.php and insert below code:

function showads() {
return '<script type="text/javascript"><!--
google_ad_client = "pub-1234567890";
google_ad_slot = "4668915978";
google_ad_width = 468;
google_ad_height = 60;
<script type="text/javascript"
add_shortcode('adsense', 'showads');

View Image for larger view

*Remember to change your own adsense pub id…

To use it on your post is very simple, switch to “Text” mode, type “adsense” ( replace quote with brackets ), and it will display the Google Adsense ads on your posts. I found that u can only put max. 2 adsense ads in single post.

Of course, if u dare not to modify the function.php file, there are plenty of wordpress adsense plugins available.

-via wprecipes

Leave a Reply

Your email address will not be published. Required fields are marked *