After posting my tutorials on how to add a banner ad in your header, someone asked me how to add 125×125 ads in your sidebar. This can be easily done by using my custom CSS and custom function below.
Custom CSS
.custom .ads { text-align: center; } .custom .ads img { margin: 1px; }
Above is the custom CSS for the ads. It makes sure that each one is centered. The one pixel margin is the spacing between each ad. The higher the pixel value the more spacing there will be between each ad. You can change it according to your own preferences.
Custom Functions
function custom_ADS() { ?>
<div class="ads">
<h3>Franklin's Sponsors</h3>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
<a href="#"><img src="http://franklinbishop.net/wp-content/uploads/2009/04/add.gif" alt="" /></a>
</div>
<?php }
add_action('thesis_hook_before_sidebars', 'custom_ADS');Above is what you’ll need to put in your custom functions file. You’ll just need to change the URLs and the image URLs. Then you will be set. If you would like to place it above sidebar 1 then put thesis_hook_before_sidebar_1 and if you want to put it before sidebar 2 then put thesis_hook_before_sidebar_2.
If you would rather put it somewhere else in your sidebar then you can just take the HTML out of the custom function above and place it in a text/HTML widget. It will work just like if you were to add a function above the sidebar. There should be no problems with this.
Below I have taken a screenshot of what it would look like on my blog. I just used grey images for example ads. If it doesn’t come out the same way, then just ask for some help. You can either ask me on here or find me on the thesis forums.

{ 7 trackbacks }
{ 8 comments… read them below or add one }
Excellent tutorial Franklin thanks for taking the time to explain
Franklin,
I tried your coding on my test site (above) and can’t seem to get it to work. I am using Thesis OpenHook.
Any suggestions?
great tutorial, thanks your tips for me.
Some really useful information you’ve posted here, thanks so much! This will be really helpful in making sure the coding of our ads is correct. You write really well too! Thanks!
thank you so much , it’s been a long time since i was looking for how to place 125*125 ad places on my website , i though it was more difficult than that
thank you
Thank you! I’ve tried other tutorials, but I could never get my ads to show up right. Now, it looks great.
Nice tutorial. However, could you explain how to make these links clickable?
Renn, simply replace the hashtag in the ‘a href’ bit with a full url and the ‘img source’ bit with the full url to where your advert graphics are.
Nice simple tutorial, many thanks.