Thesis Tutorial: Ads in Sidebar

by Franklin Bishop on April 26, 2009

thesis-designerAfter 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.

screenshot-ads

{ 7 trackbacks }

links for 2009-04-29 | girliegeek
April 29, 2009 at 2:03 am
27 Links to help you with Thesis — Serradinho
May 28, 2009 at 4:21 pm
List of Wordpress Thesis Theme Tutorials, Tips and Hacks - EzyBlogger
July 17, 2009 at 10:11 am
List of Wordpress Thesis Theme Tutorials, Tips and Hacks | Choose 4 Me
August 2, 2009 at 12:13 am
60 Wonderful And Helpful Thesis Customization Tutorials - Cash-Bandit.com
September 13, 2009 at 9:03 am
10 hacks for the Thesis WordPress theme
November 30, 2009 at 4:35 am
60 Wonderful And Helpful Thesis Theme Customization Tutorials
December 3, 2009 at 9:47 am

{ 8 comments… read them below or add one }

Nokia Mobile Talk April 27, 2009 at 8:44 am

Excellent tutorial Franklin thanks for taking the time to explain :)

Reply

Mark May 5, 2009 at 9:02 pm

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?

Reply

iklan May 8, 2009 at 11:33 am

great tutorial, thanks your tips for me.

Reply

Poster Printing May 22, 2009 at 12:18 am

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!

Reply

cars May 26, 2009 at 2:09 pm

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

Reply

Stacie @ newmommyhelp.net July 10, 2009 at 11:15 pm

Thank you! I’ve tried other tutorials, but I could never get my ads to show up right. Now, it looks great.

Reply

Renn July 13, 2009 at 3:17 am

Nice tutorial. However, could you explain how to make these links clickable?

Reply

Neill Watson July 24, 2009 at 10:44 am

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.

Reply

Leave a Comment

Previous post: 5 Advertising Plugins for Wordpress

Next post: Website Grader – Website Grades that Count