Inserting Adsense Code To Your Blog Post

First of all, I would like to thank Nasrun for giving me a feedback on my Adsense placing in my blog post and he wanted to know how I manage to do it? This is what I expect from my readers. The purpose of the comment on my blog is to give feedback and I really appreciate Nasrun’s comment on this. Other readers, if you want to know any tips or tutorial, ask away and I will be glad to write one (provided I have time to do it). Well, as I promised, this is the tutorial on how to do it. Actually, it’s pretty simple.


The trick

Actually, the trick is playing some CSS and div layer tag in your theme file. In this case, I only put my Adsense code in single post file. Go to your theme and edit the file that you want your Adsense code to appear. In this case, usually it will be index.php or single.php.

Get the Adsense code

After that, create a new Adsense ads from Adsense dashboard. Typically, the best ad for this is 200×200, but it all depends on your theme. In this tutorial, I will use 200×200. Assuming you guys already have the code, here’s the next step.

Combine your Adsense code

Look at the code below and insert your Adsense code at the designated spot.


You can customize the div style as you wish. Usually people play around with float to make it left or right position and the margin. I’m no expert in CSS and HTML, but this should do the trick.

Paste the code into the theme file accordingly

Depending where you want your code to appear, it’s up to you really. If you want to see where I put it, here’s the screenshot. You can check my post to see where it’s lcoated.


Save the changes and check how it looks

Save the config and view your new post. The Adsense will appear in your post shortly. If you have any problem with the permission on editing the php file from WordPress dashboard, you can refer to my tutorial on changing the WordPress file permission :halo:

So Nasrun, hope you’re satisfied with my tutorial and please ask me if you have any problem ! :smile: