Create a Header Widget in Thesis

October 24, 2010
By

Post image for Create a Header Widget in Thesis

Copyright © 2010 Yorgo Nestoridis. Visit the original article at http://yorgonestoridis.com/yorgo-nestoridis-development/semiomantics/create-a-header-widget-in-thesis.


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.


Author: Yorgo Nestoridis, Media Marketing & Publishing, Founder of YORGOO Publishing, YORGOO Press and Semiomantics.

If you enjoyed reading the above, please consider following future tips and strategies by RSS reader, Email delivery, or Kindle subscription.

This page is wiki editable click here to edit this page.

Related posts:

  1. Semiomantics Thesis Interpretation
  2. How to Customize WordPress 2
  3. Make Money with YORGOO Press Seminar
  4. Create a Favicon with Photoshop
  5. How to Create an Ad for Sneakers

Tags: , , , , , , , , , , , , , , , , , , , , , ,