Inserting Adsense Code in WP Template

Now I'm ready to insert the Google Adsense code into my Wordpress Template. On my Wordpress Dashboard, I select "Presentation" and then "Theme Editor" (See earlier post on using the Dashboard). I am now editing the theme "Ads Minded". On the right, I see a list of files that are part of this theme. Now I click "squaresidebar.php" and then, in the editor box, delete everything else except the very first and last lines with the "div" in them.

Now, between those two lines I insert my Adsense code by going to the Adsense code page and clicking on the code (this will select all), then copy (CTRL-C in Windows, command(apple)-C on a Mac), and then go to the Wordpress Theme editor again and click on the editor between the above two lines, and then hit paste (CTRL-V or CMD-V).

Now I ended up with this:

Adsense Blogging 3

I've replaced my unique publisher codes with XXXXX for the image here. You will have your own unique publisher and channel ID's on your page.

OK, now I just click "update file" on the bottom right, and then I'm done! My first real ad will appear on the top right on the main page of my blog. At first it'll just display public service ads, but once the Adsense program gets a hang of my blog, it'll start placing relevant ads there, and I start making money, and if you've followed me this far - so will you!

Next, let's add some link units to the grey tabs in the header area. Just go to Google Adsense Ad Setup, select Link unit, then just follow the instructions, choose 4 links per unit, and choose #545454 as the hex color code for background, and #FFFFFF for the text color, move on to code selection, then copy the code. Remember to create a new channel for the link units! Go to your Wordpress Theme Editor, choose headerads.php and look for the text that says to delete everything and inserting Link unit code instead. You should end up with something like this:

<?php /* Delete off the codes below (from here until ***** line)
and put in your Link Units AdSense codes */ 
?>
<p><script type="text/javascript"><!–
google_ad_client = "pub-xxxxxxxxxxxx";
google_alternate_color = "545454″;
google_ad_width = 728;
google_ad_height = 15;
google_ad_format = "728×15_0ads_al";
google_ad_channel ="xxxxxxxxxx";
google_color_border = "545454″;
google_color_bg = "545454″;
google_color_link = "FFFFFF";
google_color_text = "333333″;
google_color_url = "B6B6B6″;
//–></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>
</div>
</div>
<!– End Of Class topbar –>

Now just update the file (bottom right) and go and admire your new link units! Remember that it may take some time before any link units appear.




Google
 
Web innerblogger.com



One Response to 'Inserting Adsense Code in WP Template'

  1. Adsense Tabs and Wordpress Themes » InnerBlogger - The Guide to Successful and Profitable Blogging - August 23rd, 2007 at 7:33 am

    […] This question has been answered in: How to Insert Ad Code in Wordpress Template One more question ,if I may: I use Bluehost as well. If I want to try a different theme,do I simply create a new directory,and upload the zip files to it ? Will this interfere with any other blogs,or are they all treated as separate ? […]


Leave a Reply