widgets in top right header
-
Hello,
I used this code to integrate a top right header widget area for displaying widgets on the right side of the logo:
<?php
function meso_add_new_widget() {
register_sidebar(array(
‘name’=>__(‘Top Right Header’, TEMPLATE_DOMAIN),
‘id’ => ‘top-right-header’,
‘description’ => __( ‘Top Right Header widget area’, TEMPLATE_DOMAIN ),
‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<p>’,
‘after_title’ => ‘</p>’,
));
}
add_action( ‘widgets_init’, ‘meso_add_new_widget’, 10 );function meso_add_top_right_header_widget() {
if ( is_active_sidebar( ‘top-right-header’ ) ) {
dynamic_sidebar( ‘top-right-header’ );
}
}
add_action(‘bp_top_right_header’,’meso_add_top_right_header_widget’);
?>open header.php go to line 113 and add this:
<?php do_action(‘bp_top_right_header’); ?>Now what happens is that the widgets I add in this widget area are showing above the website logo instead of right next to the logo. I tried changing to float of #header to the left, but that is not working.
Can anybody show me what I am doing wrong?
I am using Woocommerce plugin.Many thanks,
D-work
-
edit this
function meso_add_top_right_header_widget() { if ( is_active_sidebar( 'top-right-header' ) ) { dynamic_sidebar( 'top-right-header' ); } }to
function meso_add_top_right_header_widget() { if ( is_active_sidebar( 'top-right-header' ) ) { echo '<div style="float:right;margin:15px 0 0;">'; dynamic_sidebar( 'top-right-header' ); echo '</div>'; } }
The topic ‘widgets in top right header’ is closed to new replies.
