Home / Tutorials / Embed Google Adsense anywhere in your post

Embed Google Adsense anywhere in your post

/
/
425 Views

Today I’m gonna show how to Embed Google Adsense anywhere in your post, you can put your ad in anywhere in post like after the image, after a paragraph or in the middle of the post.

Don’t forget to Subscribe to Email Newsletter, Follow us on Twitter and Like us on Facebook – for recent updates.

Just follow the below steps:

1. First you need add the following code in your function.php file of your theme

function showads() {
return '<script type="text/javascript"><!--
google_ad_client = "pub-2027406933994659";
/* 300x250 Sidebar */
google_ad_slot = "5310377007";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
';
}

add_shortcode('adsense', 'showads');

Note: Don’t forget to change the adsense code otherwise it will display my ads on your own site.

2. 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 of your post:

[adsense]

Do you know any other wordpress tip? Let us know

Don’t forget to Subscribe to Email Newsletter, Follow us on Twitter and Like us on Facebook – for recent updates.

Subscribe to our Newsletter

If you liked this article, then please subscribe to our newsletter for latest web resources. You can also find us on Twitter and Facebook.

2 Comments

    • You need to set the color of title, URL and text according to your theme so that it looks like it is the part of the website. You can do this by logging to you adsense account & modify your ad type and than set the color according to your requirement.

Leave a Comment

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

Subscribe To Our Blog For All The Latest & Greatest Freebies!

Following our blog is a great way to make sure that you are up to date on the latest and greatest Freebies and WordPress news.

We don't spam and your information will never be shared.

Subscribe To Our Blog For All The Latest & Greatest Freebies!

Following our blog is a great way to make sure that you are up to date on the latest and greatest Freebies and WordPress news.

We don't spam and your information will never be shared.