I'd like to have an aside/sidebar in my #header and i saw this post from Chris who seems to know the solution. I couldn't use it (I'm new to php) and would like to just copy and paste code for now. where should I paste what?
// Adding a new widgetized area .. took my favorite one .. the header aside:
// First code is needed to create the widgetized area:
function add_header_aside($content) {
$content['Header Aside'] = array(
'args' => array (
'name' => 'Header Aside',
'id' => 'header-aside',
'before_widget' => thematic_before_widget(),
'after_widget' => thematic_after_widget(),
'before_title' => thematic_before_title(),
'after_title' => thematic_after_title(),
),
'action_hook' => 'thematic_header',
'function' => 'thematic_header_aside',
'priority' => 8,
);
return $content;
}
add_filter('thematic_widgetized_areas', 'add_header_aside');
// And this is our new function that displays the widgetized area
function thematic_header_aside() {
if (is_sidebar_active('header-aside')) {
echo thematic_before_widget_area('header-aside');
dynamic_sidebar('header-aside');
echo thematic_after_widget_area('header-aside');
}
}
//The following code will change the header as needed:
// First we remove the thematic_brandingopen() .. we're going to make one addition for this one.
// And we remove thematic_access() .. will be added later unchanged with a priority of 10.
function remove_branding() {
remove_action('thematic_header','thematic_brandingopen',1);
remove_action('thematic_header','thematic_access',9);
}
add_action('init', 'remove_branding');
// We wrap #branding and #header-aside with #header-box
function childtheme_brandingopen() { ?>
<div id="header_box">
<div id="branding">
<?php }
add_action('thematic_header','childtheme_brandingopen',1);
// Now we need to close #header-box
function header_box_close() { ?>
</div>
<?php }
add_action('thematic_header', 'header_box_close', 9);
// And we add the unchanged thematic_access() with the new priority 10
add_action('thematic_header','thematic_access', 10);
Plus the CSS:
#header_box {
clear: both;
margin: 0 auto;
overflow: hidden;
position: relative;
width: 960px;
}
#branding {
float: left;
width: 620px;
}
/* Moves the new widgetized area to the right and levels it with #branding */
#header-aside {
float: right;
width: 300px;
padding: 88px 0 44px;
}
/* This will clear the floats and keeps the access bottom line
from jumping into the air */
#access {
clear: both;
}
Checked!
Please keep in mind ... to add an additional widgetized area normally only the first code section is required!
Chris
Posted 2 months ago #