Thesis Tutorial: Banner Ad in Header

by Franklin Bishop on April 19, 2009

thesis-designerPeople that are using the Thesis Wordpress theme have been wanting to know how I added a banner ad in my header. Since others were having problems, including myself, with the traditional way of coding this, I decided to do it differently.

Below I have shown you what I put in my custom CSS file and custom functions file. I left my code in their so that it is easy to see where to delete and insert your own code.

Custom Function

function my_header_ad() { ?>
<div id="leaderboard_ad"><a href=""><img src="image url" alt="" /></a></div>
<?php }
add_action('thesis_hook_header', 'my_header_ad');

Custom CSS

.custom #leaderboard_ad { float: right; position: absolute; width: 468px; height: 60px; top: 15px; left: 502px; }

Now make sure you change the CSS so that it fits in your header. For top, the higher the pixel value the lower it will be. For left, the higher the pixel value the farther to the right it will be. You will have to play with it so it fits your header the way you like it.

Hopefully this Thesis Tutorial can help you get a banner ad in your header. As always, there are little things that can mess this up. So if you have troubles let me know.

{ 5 trackbacks }

links for 2009-04-21 | girliegeek
April 21, 2009 at 2:03 am
List of Wordpress Thesis Theme Tutorials, Tips and Hacks - EzyBlogger
July 17, 2009 at 10:10 am
List of Wordpress Thesis Theme Tutorials, Tips and Hacks | Choose 4 Me
August 2, 2009 at 12:12 am
Mini-Tips, Facebook Connect, a Contest and More Answers! | 3asslema4Host
August 13, 2009 at 7:07 am
250+ Thesis Theme Resources | Sahil Kotak dot Com
December 8, 2009 at 2:26 pm

{ 41 comments… read them below or add one }

Lainie Petersen April 19, 2009 at 7:50 pm

Franklin,

I love Thesis too. . .have you ever tried working with ? I adore it.

Reply

Lainie Petersen April 19, 2009 at 7:51 pm

Argh! The link didn’t work…I was referring to the Open Hook plug-in for Thesis.

Reply

Franklin Bishop April 19, 2009 at 8:50 pm

Yeah, I didn’t like it much. I’m too use to helping people in the support forum who do not use it. I’ll add how to easily add it to the open hook plugin at the bottom.

Reply

Melody April 19, 2009 at 10:55 pm

The banner blends in really well with this theme..

Reply

John @ Wollongong Web Design April 19, 2009 at 11:52 pm

Yes your banner looks great and this tutorial is a big help to those who a want a similar one.

Reply

blinkky April 20, 2009 at 12:29 am

I agree with you melody. The header seems very comfort with the colors…

Reply

Ann @ Work From Home April 21, 2009 at 3:43 pm

Thanks for the great guide, I am not using Thesis, but I did find this helpful for my theme, as I have been trying to do this but neglected to change my CSS

Reply

uprinting.com promotions April 21, 2009 at 6:46 pm

Really true…I’m liking the colors!

Reply

Michelle April 21, 2009 at 10:35 pm

Hi, this didn’t work for me. I am actually trying to put two ads beside eachother (using the header hook) – not sure why my 2nd ad is not showing up.

Here’s what I have in the header hook:

And then in custom.css:
.custom #header_welcome { float: right; position: absolute; width: 168px; height: 90px; /*top: 15px; left: 502px;*/ }

The 2nd (welcome) ad doesn’t show up. Any ideas what I am doing wrong? Thanks!

Reply

Michelle April 21, 2009 at 10:36 pm

Hmm looks like my code didn’t display my previous comment. Here it is again (this is in my header hook):

Reply

Jorge Ledesma April 23, 2009 at 6:40 pm

Hey great tip, thanks for sharing, do you know any more tricks for perhaps a footer and sidebar ads :) thanks mate

Reply

Franklin Bishop April 23, 2009 at 6:47 pm

Yeah, what are you looking for?

Reply

Jorge Ledesma April 23, 2009 at 8:42 pm

Hey, thanks for replying, you have a great site and a great about page, well I’m kind of new blogging its only been 2 yrs on and off and I’ve decided to make a go with my site(this is strictly a hobby of mine, I’m actually a dentist) to increase my rss readers and maybe make a little money nothing serious but my goal is maybe a $500, I’d like to donate these monies to charity of mine. Anyway back to the question I’d like to have a few banners, I read on another site that the following banners are a must(what do you think) 125×125, 300×250, 468×60(which I’m sure you agree lol), 120×600, and a 260×32 so I’m thinking its a similar code, anyway I would appreciate any insight or help.

Thanks Franklin and again great site, to be honest, there are lot site that deal with your topic but your kind off captivated me, the style is smooth and kind off kicks your inquisitive side, so congrats good job, you got me.

Jorge

Reply

Franklin Bishop April 24, 2009 at 9:00 pm

I would use a plugin for 125×125 (which seem to be the best). I can do a tutorial for you tomorrow really quick. It will be best or a 468×60 which has worked wonders for me.

Reply

Nokia Mobile Talk April 24, 2009 at 9:56 am

I’m definitely doing this, any thoughts on the above comment – Jorge Ledesma, that’s me :)

Reply

Jen April 25, 2009 at 2:37 pm

Hi Franklin. Thanks so much for this code. For some reason it just won’t work on my site though. Any thoughts?

Reply

EverydayGuide May 1, 2009 at 11:44 am

Hi,

I came here from the thesis forum. Can you tell me how to place a 468×60 Google Adsense ad instead of a static image banner?

Reply

Adrian May 10, 2009 at 5:53 am

mee tooo

Reply

Ms. C May 11, 2009 at 11:21 am

Inside the div, put your AdSense code instead of the . Just put it between the opening and closing div tags. The css code should be the same.

(added spaces to the tags in hopes they’ll show up…)

Reply

Ms. C May 11, 2009 at 11:23 am

Ok, that didn’t show up. Trying again without the code. (You can delete my other comment…)

Just replace everything between the opening and closing div tags in the custom function code with your AdSense banner code. Styling should be the same.

Reply

Reddy May 12, 2009 at 9:46 am

Can you tell me how to place a 468×60 Google Adsense ad in the header???

Reply

johnwalker34 May 12, 2009 at 9:48 am

Can you please write a tutorial about it
thanks

Reply

fanari May 4, 2009 at 11:59 am

thanks for this tutorial :)

Reply

Brian May 12, 2009 at 9:45 am

hey
i want to know it, too

Reply

andrew May 21, 2009 at 3:13 pm

hey thanks – this is great. I’m getting it to show up, but i can’t make the ad in the header stationary. in other words, when i make my browser window smaller and larger, it moves the ad around.

do you know how to make it “stick” there?

Reply

Franklin Bishop May 22, 2009 at 10:57 am

Should already stick. Can you show me?

Reply

andrew May 22, 2009 at 11:47 am

Franklin – It’s my bad, I got it to work. Basically the “twist” was

position: absolute;

vs.

position: fixed;

I’m a nooob. :)

This tutorial rocked.

Reply

Mark McGuinness May 23, 2009 at 9:41 am

Thanks this is awesome! Just added a banner on my homepage.

Reply

the Unhygenius June 16, 2009 at 9:32 pm

Franklin— thanks for the tutorial.. i have it partially working.. im attempting to use this to put a hyper-linked banner ad [not adsense] into the header. i would like it to the right of the logo — which i have already replaced with an image. so far, the banner ad is scaling with opening and closing the window, independently of the rest of the blog. wheras yours moves as it should. im using the code you provided, except i have specified a BG image in the css [the banner ad] is this a common problem? what should i do?

Reply

the Unhygenius June 16, 2009 at 9:40 pm

heres the code i used to replace the blog title with a logo image… is this part of the problem perhaps?

thanks! — K

/* This line sets up our clickable background image based on the site title’s link */
/* DIY: Adjust the height & width attributes to reflect the actual size of your image */
/* DIY: Change the filename of your image to reflect the actual header’s file name */
.custom #header #logo a { display: block; height: 100px; width: 486px; background: url(’images/annlogo_h.png’) no-repeat; outline: none; margin-top:10px;}

/* This line gets rid of the site title & tagline by casting them out to far left field */
.custom #header #logo, .custom #header #tagline { text-indent: -9999px; }

/* This line collapses the vertical space of the tagline so that there isn’t unnecessary white space after the header image */

/* This is a bit of a kludge, but it seems to work. */
.custom #header #tagline { height: 0; }

/* This line removes the padding from the header so that the background image sits close to the nav menu, the bottom border of the header, and the sides of the content */
.custom #header { padding: 0; }

Reply

Latest News August 1, 2009 at 5:44 am

Thanks for give great tips , i am searching from last one month and finaly get it and use it , So many Thanks for this Tips , we are using in header

Reply

Zdeno August 5, 2009 at 1:53 pm

Hi Franklin
Thanks for great tips about adding ad to header. Works great but i have small small problem. When i tested this with different resolutions, ad is moving and not align nice with right side of my site. Same thing when i open bookmarks on my left side in firefox. How can i fix this banner to stay in place and aligned with my right border with any resolution or screen size instead of floating around?
Thanks in advance

Reply

chris August 23, 2009 at 6:08 am

Nice tutorial Franklin. Worked great with my site.

Do you have any idea on how to make it a rotating banner?

Cheers

Reply

Magic Power Coffee August 29, 2009 at 8:50 am

thanks for the tutorial… awesome !!!

Reply

Leave a Comment

Previous post: What is Twitter and Why Join Twitter?

Next post: Get More Followers on Twitter and Grow Your Online Presence