+321 123 4567
info@test.com
  • Home
  • My Services
    • Web Design
    • Web Development
    • Technical Writing
  • Portfolio
  • My Thoughts
  • Free Tools
    • Photo Editor
    • Avatar Generator
    • Email Migration Tool
    • QR Code Generator
    • RSS to HTML Converter
    • Rich Text Editor
    • IP Address Geolocation
    • Base64 Image Encoder
    • NATO Translator
    • All Tools
  • Contact
Home
Wordpress
Adding Google Adsense to Worpress without any Plugin

Adding Google Adsense to Worpress without any Plugin

Wale Adekile
February 18, 2012

I was using a wordpress google adsense plugin to add google ads to this blog before I saw something that eventually made me change my mind about adsense plugins. I finished writing a post that day, previewed it and saw one of my ad units in a color I never used. Knowing what could be wrong, I checked the publisher’s ID and saw it was totally different from mine! It was only then I realized I had been sharing my revenue with the plugin developer without my knowledge. It was at that very moment I decided not to use anymore wordpress google adsense plugin and tried inserting ad units manually.


Adding Google Ads below the Menu

– Go to Appearance > Template Editor

– Open header.php

– In the very last line, paste this code:


<div align="center" style="display:block; width:950px; margin-right:0; background: #ffffff;">

YOUR ADSENSE CODE HERE

</div>

I used this to add a 728×90 leaderboard below the header, see that? You should note the following:

width:950px – this represents your blog width. You should increase or decrease this if there’s a need to do that.

background: #ffffff – this is the default background. If you have a dark you should change the color code to 000000

YOUR ADSENSE CODE HERE – Paste your adsense code here

Adding Google Ads below Post Title


– Open single.php

– Locate where the post body starts. If your theme supports thumbnails, it shoul be just before this code:

<?php
if(has_post_thumbnail()) {

– Paste your adsense code just before this.

– If your theme dosn’t support thumbnails, you should paste your adsense code just before this:

<?php
the_content('');

Below is what it should look like:

how to add google adsense to wordpress without plugin

Adding Google Ads Before Comments

Locate this code in single.php and add the code just before it:

<?php
if(comments_open( get_the_ID() )) {
comments_template('', true);

Adding Goolge Ads on the Sidebar(s)

– You don’t need to edit your template to do this, just go to Appearance > Widgets

– Drag Text widget to your desired position and paste your code inside it.

Google Adsense in Other Positions

If you’re not comfortable with editing your template, there’s a way out.Udegbunam Chukwudi of Patchworkoftips introduced a plugin to me. This plugin’s not an adsense plugin but rather a plugin to define how your post layout looks like. Post Layout allows you to use all sort of text, html, javascript anywhere in your posts and I recommend it.


Previous Post
Displaying Blog Author’s Google+ Profile Pic in Search Results
Next Post
Glo Free Browsing Settings on Opera Mini and Ucweb/ UC Browser
Wale Adekile
Husband to the world's most beautiful woman and father to two awesome kids. A nerd, obviously; also, a technical business analyst, a web designer who preaches the gospel of WordPress, and a writer. You can check out my published books on Amazon.
how to migrate, move, copy or export blog posts from blogger to wordpress
BloggerWordpress

Moving Your Blog From Blogger To WordPress Without Losing Traffic And SEO

14 years ago
Wordpress-icon
Wordpress

How to Make WordPress Tags Link to Search Page

9 years ago

Recent Articles

wahl rapic clip hair clipper
Wahl Rapid Clip Hair Clipper Review: DIY Made Easy
BenQ LaptopBar Review: Luxury or Necessity?
yunmai easepro unboxed
Yunmai EasePro Massage Gun Review
g20
Teendow G20 Robot Vacuum and Mop Review
bathroom
Dear Men, Spraying All Over the Toilet Seat is Disgusting and Irresponsible
winx mediatrans
How to Transfer Photos from iPhone to Computer Without iTunes
google workspace
How to Migrate Emails From Google Workspace/G Suite to cPanel
synology diskstation ds920+
Synology DiskStation DS920+ Review
playstation 4
Why I haven’t Upgraded to the PlayStation 5 Yet
pain
Started Watching Anime as an Adult? You’re Not Alone

All contents on this blog are copyright protected and cannot be reproduced on other websites without permission.

Copyright © 2022 – NerdieDad | Home | Contact | About | Privacy Policy