To add an extra widget area at the top right of the header are of the WordPress Twenty Twelve Theme, follow these steps.
Add this to a functions.php file in the child theme
//add a widget area in the header
if ( function_exists (‘register_sidebar’) )
register_sidebar( array(
‘name’ => __( ‘Header Widgets Area’, ‘twentytwelve’ ),
‘id’ => ‘sidebar-header’,
‘description’ => __( ‘A new header widgets area for my child them’ , ‘twentytwelve’ ),
‘before_widget’ => ‘
<aside class=”widget %2$s” id=”%1$s”>’,
‘after_widget’ => ‘</aside>’,
‘before_title’ => ‘
<h3 class=”widget-title”>’,
‘after_title’ => ‘</h3>
‘,
) );
add_action( ‘widgets_init’, ‘twentytwelve_widgets_init’ );
Create new file called sidebar-header.php
and add this code
<!–?php if ( is_active_sidebar( ‘sidebar-header’ ) ) : ?–>
<div id=”headWidgets” role=”complementary”></div>
<!–?php endif; ?–>
In the child theme add the following to the header.php file.
If the child theme does NOT have a header.php, copy this from the main theme, and then add the line where you want it to appear.
<!–?php get_sidebar( ‘header’ ); ?–>
Add the following code in style.css to right align this new widget
#headWidgets{
position: relative;
margin-top: -135px;
float: right;
margin-right: 10px;
}
94.1 - 873,799