Thesis Header Widget
If you would like to display content, for example an advertising banner, in your header area, you may want to create a new widget. Creating Custom Widgets is a simple affair in Thesis as you need just to register a sidebar and hook the widget to the thesis hook where you would like to display your content.
Create a Custom Widget in Thesis
1. Create the Custom Header Widget by pasting the following code into your custom-functions.php:
//-------------Create Header Widget------------
register_sidebars(1,
array(
'name' => 'Header Widget',
'before_widget' => '<li class="widget %2$s" id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>'
)
);
function header_widget() { ?>
<div id="header_widget_1" class="sidebar">
<ul class="sidebar_list">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Header Widget') ){ ?>
<li class="widget"><h3><?php _e('Header Widget', 'thesis'); ?></h3>Edit the widget content from your WP Widgets panel under Appearance :-).</li><?php } ?>
</ul>
</div>
<?php }
add_action('thesis_hook_header', 'header_widget', '1');2. Position your widget pasting the following to your custom.css:
/*--------Header Widget for a 468 px banner-------------- */
.custom .sidebar ul.sidebar_list {position: relative;}
.custom #header_widget_1 ul.sidebar_list li.widget {position: absolute; display: block; top:0px; left:524px; width:468px; }The positioning will depend on the width of your theme and you may have to adjust the absolute position from the left (left:524px;)
3. Head over to the widget panel in your dashboard and you will find a brand new shiny widget area ready to be populated: add a text widget and punch in your banner code or any other content and check out the display on your site.
That’s it.
If you enjoyed reading the above, please consider following future tips and strategies by RSS reader, Email delivery, or Kindle subscription.Author: Yorgo Nestoridis, Media Marketing & Publishing, Founder of YORGOO Publishing, YORGOO Press and Semiomantics.
![]()
Related posts:




