Add Header widget for banner ads (widgetized banner header) for thesis theme

Gowtham V
2 Min Read

Creating a widget for header(Widgetized header) will be an easy way to edit your content rather than adding the code directly to the custom_functions.php.In this method you will create a widget for header and add the code using a text widget.

Follow these simple steps to add a  header widget for thesis theme.

1.Using your FTP client open your custom_functions.php file located in the thesis theme custom folder

2.Add the below code to the custom_functions.php file in the custom folder

/*Build Header Widget*/
        '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">
			<?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 } ?>
<?php }
add_action('thesis_hook_header', 'header_widget', '1');

3.Open your custom.css file and add the below css code to your custom.css file in the same custom folder

.custom .sidebar ul.sidebar_list {position: relative;}
.custom #header_widget_1 ul.sidebar_list li.widget {position: absolute; display: block; top:0px; left:477px; width:468px; }

4.Now save your css file and go to Appearance>>Widgets options,a new sidebar will be added like below


5.Add a text widget into the Header Widget area and add the code for the banner add.

You can also add  share buttons  near to your logo using this method,for that just add the respective code in the text widget instead of the banner ads code.

Hope you have successfully added them to your theme.If you have any problem adding the Header Widget to your blog,we will help you via the comment section.

Share This Article

Leave a Reply

Your email address will not be published. Required fields are marked *