Hello,
I have used various functions found here to:
Create a page with no sidebar,
add a widget to the header &
move the navigation to the top of the page.
I am having some problems with the positioning of the branding & widget; the widget is appearing below branding. Not sure if there is a conflict here or not.
Can someone check my functions.php please?
<?php
//CREATE A PAGE W NO SIDEBAR
// filter thematic_sidebar() .. no display for the page 'Gallery', keep it for the rest
function remove_sidebar() {
// We test if we are on the page 'Gallery'
if (is_page('gallery')) {
// Yes, we are .. now we switch off the sidebar
return FALSE;
} else {
// we are not .. we leave the switch on
return TRUE;
}
}
// Connect the filter to thematic_sidebar()
add_filter('thematic_sidebar', 'remove_sidebar');
//ADD WIDGET TO HEADER
/// This will create your widget area
function my_widgets_init() {
register_sidebar(array(
'name' => 'Header Aside',
'id' => 'header-aside',
'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
'after_widget' => "",
'before_title' => "<h3 class=\"widgettitle\">",
'after_title' => "</h3>\n",
));
}
add_action( 'init', 'my_widgets_init' );
// adding the widget area to your child theme
function my_header_widgets() {
if ( function_exists('dynamic_sidebar') && is_sidebar_active('header-aside') ) {
echo '<div id="header-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
dynamic_sidebar('header-aside');
echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
echo "\n" . '</div><!-- #header-box -->'. "\n";
}
}
add_action('thematic_header', 'my_header_widgets', 8);
function remove_branding() {
remove_action('thematic_header','thematic_brandingopen',1);
}
add_action('init', 'remove_branding');
function my_brandingopen() { ?>
<div id="header_box">
<div id="branding">
<?php }
add_action('thematic_header','my_brandingopen',1);
//MOVE ACCESS NAVI TO TOP OF PAGE
function new_header() {
remove_action('thematic_header','thematic_brandingopen',1);
remove_action('thematic_header','thematic_access',9);
}
add_action('init', 'new_header');
add_action('thematic_header','thematic_access',1);
add_action('thematic_header','thematic_brandingopen',2);
?>