I had a perfect little hack that added a widget area to the top right of the header. This worked great when setting the logo to the left and the menu below.
I would add the following to the function.php file….
register_sidebar( array(
‘name’ => __( ‘Header Area’, ‘plus’ ),
‘id’ => ‘sidebar-2’,
‘description’ => __( ‘An optional widget area for your site header’, ‘your-theme’ ),
‘before_widget’ => ‘<div id=”%1$s” class=”headwidget %2$s”>’,
‘after_widget’ => “</div>”,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
) );
}
add_action( ‘widgets_init’, ‘my_widgets_init’ );
I would then add into /includes/helper-main-menu.php
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘sidebar-2’) ) : ?>
<?php endif; ?>
I would also add some CSS to style and position the widget area.
Since the latest update this has stopped working and breaks the widgets page in wordpress.
Can you offer a fix or some advice on how I can get this working again.
Luke
Hi Luke!
Have you seen this post – http://kriesi.at/documentation/enfold/adding-a-widget-area-to-the-header/?
Best regards,
Yigit
Hey Yigit,
Can you let me know what CSS code I would need to align the widget area to the right side, opposite the logo.
#header .widget {
left: 50%;
padding-top: 0;
position: absolute;
top: 0;
transform: translate(-50%);
z-index: 999;
}
I removed left: 50%; and put right:0; and it goes to the very far right side which looks odd.
Hi!
In that case try using the “ava_before_bottom_main_menu” filter instead of the “ava_main_header”. That should place it inside the same container as the logo so it doesn’t go all the way to the right side of the page.
Regards,
Elliott