[Thesis Customization] Placing Banner Advertisement In WordPress Blog Header

[Thesis Tutorial] Placing Banner Advertisement In Wordpress Blog Header

Last few months, I’ve been using Thesis Theme for my blogs. It’s a GREAT theme with tons of customization features for the bloggers and designers. In early days of using Thesis, I was facing a problem in positioning a banner advertisement at Thesis header.

I searched on Google and reached at Francklin Bishop’s website and tried his solution. His positioning and CSS tweaking was fine with fixed display resolution, but if I tried to resize the window, advertisement was moving out from it’s position. However, I kept experimenting on the same code and ultimately I fixed the problem.

Custom Function (custom_functions.php)

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.css)

.custom #leaderboard_ad {
float: right;
position: absolute;
width: 468px;
height: 60px;
top: 100px;
padding-left: 52em;
}

Once you added the code in your custom_functions.php and custom.css files, you can change width, height, top and padding-left according to your website design and layout.

If you liked this article, you may also like:

{ 16 comments… read them below or add one }

demgeht May 28, 2010 at 5:36 pm

i have a problem, in all browsers scroll the body to left :(

Reply

Jinnat Ul Hasan May 28, 2010 at 5:40 pm

Can you send me the link of your website that giving you headache? Link at your gravatar looks fine to me.

All the best.

Reply

Simon May 27, 2010 at 4:16 pm

You are a gun !!!!!!!!
Thanks mate, I was working for hours on this thing.

Thanks!!!!!!!

Reply

Jinnat Ul Hasan May 28, 2010 at 2:00 am

You are welcome. Let me know if you have any problem in customizing Thesis Theme.

All the best.

Reply

Computer Cleanup and Virus Removal Lake Geneva, WI May 13, 2010 at 7:43 am

This is –by far– the simplest example of inserting a banner as in the Thesis header. I’ve tried a few others, some of them my own, and this is the simplest. Some adjustments have to be made for image size and placement within your specific implementation of Thesis, but it works like a champ.

Karl A. Krogmann

Reply

Jojo May 2, 2010 at 4:08 am

With this code, your logo is not clickable anymore.

Reply

Jinnat Ul Hasan May 2, 2010 at 3:22 pm

Hi Jojo,
You have to put your website URL in anchor tag. In the above code, it is empty now.

Let me know if it works.

Cheers!

Reply

Jojo May 2, 2010 at 4:00 pm

I can´t click your logo on this site, too. I assume this is, because the css-code creates some sort of overlay? I tested it with Firefox and Chrome.

Reply

Jinnat Ul Hasan May 2, 2010 at 7:48 pm

Probably you are right, I didn’t notice the problem before. I’m going to investigate the error.

Thanks.

Reply

Chris Jordan March 24, 2010 at 5:45 am

Many thanks for the solution here. I’ve searched high and low and your solution was the one that really worked.

Reply

Jinnat Ul Hasan March 24, 2010 at 9:31 am

Thanks Chris. Let me know if you need further assistance.

Cheers!

Reply

Adnan March 21, 2010 at 1:16 pm

Hi bro, you should post this good tutorial in your bangla blog. Also my VERY personal request will be to keep in mind to write a tutorial on “how to customize a blog for mobile” since both the number of mobile internet users and advertisements made for mobile users has been increased rapidly.

Reply

richie March 16, 2010 at 8:07 pm

Hi complete newbie here. I understand how to add to my custom.php and custom_function.php files but where do i put my adsense code in all of this. Sorry for such a basic question. Good site by the way!

Reply

cat February 14, 2010 at 1:02 pm

I don’t understand where we should put the ad code in this solution. Thanks!

Reply

Jinnat Ul Hasan February 14, 2010 at 5:33 pm

You have to add those code to custom_functions.php and custom.php files respectively. I can see you have already showing a banner in your header area. You have to do the same thing for your ads as well.

Best of luck!

Reply

marius February 13, 2010 at 8:07 am

this code works great but im having an error , it dosent shows me the ad in internet explorer

Reply

Leave a Comment

Previous post:

Next post: