How to Add Widgetized Header in Thesis for 468 by 60 Banner Ad

by Token Health on November 7, 2011 in Thesis

I’m not sure the exact source I found the code I am using for the 468 by 60 banner ad you see at the top of TokenHealth.com but it also appears over here http://www.debajyoti.net/wordpress/add-widgetized-header-thesis-banner-ads.html

The goal is to add a 468 by 60 banner ad to the top of your WordPress blog with the Thesis theme.

The banner ad may be from Google Adsense or from some other affiliate program or some other advertiser.

As typical with Thesis theme customizations you will need to add the following code to custom_functions.php

*Build Header Widget*/
register_sidebars(1,
array(
‘name’ => ‘Header Widget’,
‘before_widget’ => ‘<li id=”%1$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’
)
);
function header_widget() { ?>
<div id=”header_widget_1″>
<ul>
<?php if (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Header Widget’) ){    ?>
<li><h3><?php _e(‘Header Widget’, ‘thesis’); ?></h3>You can edit the content that appears here by visiting your Widgets panel and modifying the <em>current widgets</em> there.</li><?php } ?>
</ul>
</div>
<?php }
add_action(‘thesis_hook_header’, ‘header_widget’, ’1′)

Then add the following code to your custom.css file

.custom #header_widget_1 ul.sidebar_list li.widget {position: absolute; display: block; top:65px; left:650px; width:468px; }

You are going to have mess with the .css file specifically the top and left settings for the pixels. This will depend on your layout and your header and the rest of your site. So you can just play around with different numbers for these 2 values to see what works well.

You will then eventually see something that looks like the following…

Now you will need to go into your WordPress Dashboard and then click on Appearance and then on Widgets. You should now see a Header Widget on the right side. Drag a Text box into the header widget. Then add your HTML code for the 468 by 60 banner ad. For example 468 by 60 banner ad code I can add would look something like this

After doing this you should have something that looks like this

And there you go, now you have successfully added a 468 by 60 banner ad to your blog.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post:

  • Alternative Media
  • Blogging
  • Companies
  • Finance
  • Health
  • Other Bloggers
  • SEO
  • Thesis
  • Viral Videos