Now that you’ve created the Ad Unit of your dreams, you need to actually add it to your site. This will differ slightly depending on MANY variations in blogging platforms and the platform templates/themes. Once again, I will give you an example of how to do this using my environment, i.e. WordPress 2.0.2 and this WordPress theme, “Aesthetic Azure“.
So, in the previous post, “Creating AdSense Ads“, the last step you did was get the code generated by Google AdSense that will display your Ad Unit chosen.
1 – Find the file that needs to be modified:
Because I have placed this ad on the right side of this page, I know that I have to look for the file that contains this section of the page. In WordPress templates, generally there are files that contain the “instructions” for the page layout and contents in different files per section of the page. Occasionally, if you have 2 side-bars (left AND right), they are contained in 1 file, something like “sidebar.php”. Other times, like with this theme, they are split up into 2 files, for example, “left.php” and “right.php”. Not all WordPress themes are the same, and they can be named anything the author wants to name them.
So, in my theme, the file I need to modify is “right.php”
2 – Find the section in the file that needs to be modified:
As you can see, my Ads appear after a section called “Links”. So, editing the file “right.php”, I look for this section in the file by scanning for the phrase “Links:”, and I see that it appears like this:
<li class=”menustyle” id=”links”><?php _e(‘Links:’); ?>
<?php get_links(-1, ‘<li>’, ‘</li>’, ‘<br />’, TRUE, ‘id’, FALSE, TRUE, -1, TRUE); ?>
So, to keep my ads in the same theme as the menu structure, I’ve just replaced the middle 3 lines, which LISTS my links, and placed my AdSense code. Like this:
<li class=”menustyle” id=”links”><?php _e(‘Sponsors:’); ?>
— all my adsense code here —
Obviously, instead of “all my adsense code here”, you would place the code that you got from the last post’s instructions.
3 – Upload your new Template:
Having modified your blog’s template, you will need to modify the live version of this template. In most cases, this is really simple, especially so in WordPress. It is just a case of going into the WordPress Admin console, clicking “Presentation”, clicking on “Theme Editor” and selecting your file on the right. Then, just overwrite the current file by pasting into the Text Area, and click “Update File” and you’re done.
So, now that you have placed your AdSense ad on your site, you should be able to monitor it’s progress. Don’t worry, the dollars don’t just start flooding in. There are a whole lot of other customisations and improvements to the ads and your site that can be done to optimize your site. For example, there is Ad Placement, and blending… We’ll discuss these in a later post.