John e-mailed me a while ago asking me on how did I place AdSense to my WordPress blog. Too bad John didn’t have a site to show me. Anyway I’ll post here my tutorial on how to add Adsense into a WP blog.
Adding AdSense After Post Titles
Let’s go on the basics first. For example: You want to add a 336 x 280 AdSense block below you post title. Open your index.php then look for the part that looks like this:
And if you want to wrap that block, like most blogs do. Add a div into the Adsense code that may look like the one below:
Just adjust the margin that suits your blog design best and of course you could also change the float to “left” or “right”.
Some have situations adding an AdSense unit on their first post but not on the second (I used to do this before ) to do that, open your index.php then look for something like this:
We’re not done yet! Look for this on your index.php:
Then place this on the part that says “****Your Adsense Code goes here****“
See, piece of cake Special thanks to tamba2 for the code.
Adding AdSense After Every Entry
If you want to place an Adsense block every after your entry ( Like what I have — for now ) You will need to open your index.php then look for this part:
And if you want, you can also add a center tag to make it look more decent.
Adding AdSense to Single Posts
If you want AdSense only in your single posts. Open your single.php then look for something like this:
Actually it’s the same as Adding AdSense After Post Titles (Above)
Adding AdSense Before your Header
Lastly, if you want to add an AdSense unit before your header (Like b5media blogs, etc.)
Open your header.php and look for a code like the one below:
But still if it’s that hard for you to integrate AdSense units to your WordPress blog, there’s always a plugins to the help.
If you have any comments or want to add or suggest something. Don’t be shy to leave me a comment
Have any questions? Don’t want to waste time searching Google? just drop me a mail and I’ll try my best to answer your question!