
This is cool and simple way of placing as many ads as you want on your site…
First thing is to upload your ads into the custom/images folder on your server
The ads in this example are 125 x 125 which is pretty typical
Next, create a simple function in your custom_functions.php to add the ads, put div tags for the ads, and give it a class name…
function ad(){?>
<div class="ads">
</div>
<?
}
Next, add an unordered list of the ads your going to use between the two div tags and include the path to the image. Your path may be different than the example below…
function ad(){?>
<div class="ads">
<ul >
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad1.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad2.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad3.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad4.png"></li>
</ul>
</div>
<?
}
I decided to put them right under the header so I placed them with the appropriate hook. Here’s how the entire function looks…
function ad(){?>
<div class="ads">
<ul >
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad1.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad2.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad3.png"></li>
<li><img src="http://www.mysite.com/wp-content/themes/thesis/custom/images/ad4.png"></li>
</ul>
</div>
<?
}
add_action(’thesis_hook_after_header’,'ads’);
Next, add the class to your custom.css and include one for the unordered list of images…
.custom .ads{}
.custom .ads ul li{}
These are the properties and values I used, yours may be different…
.custom .ads{padding: 1em; width: 94em; height: 10em;}
.custom .ads ul li{display: inline; margin-right: 1em;}
This is a really simple, fast, and effective way of placing ads on your site. Remember you can add as many ads as you want. you can also place them vertically, or in the sidebar, in the footer, in the header, etc. The possibilities are endless.











If you would like to leave a comment and you have examples of code you want to show, you must "escape the code". This allows the entire code to show correctly by inserting certain variable around certain tags to make them show. If you don't "escape the code" your code will show up broken, mangled, and it won't be able to be seen correctly. "Escaping the code" is very simple...
Go ahead, leave a comment...