How To: Add Your Google ID to an Adsense Ready WordPress Theme

69
rate this page

By janetra



So you have your adsense theme and now all you need to do to start running your ads is to put in your own Google ID or code. Let's see how easy that is to do!

There are 2 ways theme designers provide the means to accomplish this.

1) Separate files that contain only the adsense code.

This is probably the easiest method. Hopefully the theme designer will have included a README file to identify which files to edit. We'll take an example from the theme Adsense Flavors (download link below). In this theme 3 extra files are include.

These are

  • header_ad.php

  • adsense_sidebar.php

  • google-search.php

Let's see how we insert our own google ID into the adsense_sidebar.php file.

Open up the file in a text editor. Before you start it's always a good idea to make a copy of the file before you change it!This is what you will see.


All you need to do is replace

google_ad_client = "pub-0707096532234541"; with your own ID

There is no need to touch any of the core theme files. The correct code is automatically inserted for you.

2) adsense code inserted into core theme files

The theme files most usually used are

  • sidebar.php
  • header.php
  • single.php

To change the code or Google ID in sidebar.php open up the file in a text editor. Hopefully the theme author has supplied a README file with the line to be edited. If not look for a block of code similar to the code in the previous example and replace the Google ID. This is fairly easy to do but be careful not to delete or edit any other code or your page may fail to load!

To replace an ad block with a Google Search Box

In the theme example we are using, a banner ad is displayed in the header. It's a simple matter to change this to display a Google Search Box instead. Open header_ad.php (or equilvalent file for the theme you are editing - see the README file that comes with the theme for the appropriate file to edit).Replace the whole of the Google code with your own Google Search box code. Don't forget, although we are using Google adsense as an example any other ad scheme can be used instead! Just copy the code given to you by the ad server you are using and paste into the file instead.

Free adsense ready theme download

Comments

RSS for comments on this Hub Small RSS Icon

No comments yet.

Submit a Comment

Members and Guests

Sign in or sign up and post using a hubpages account.


optional



working