WordPress.org

Support

Support » How-To and Troubleshooting » Problems after creating new widget area

Problems after creating new widget area

  • Hello,

    I’m actually setting up a new menu above the logo and header banner. I’m using the jQuery mega menu for this purpose.

    I have registered the nav menu in functions.php as :

    register_nav_menus( array(
    'primary' => __( 'Primary Navigation', 'gonzo' ),
    'mobile' => __( 'Mobile Navigation', 'gonzo' ),
    'header banner' => __( 'Header Banner Menu', 'gonzo' )
    ) );

    I have also called the widget in the Header.php using :

    <div id="header-widgets">
    <?php dynamic_sidebar('header-widgets'); ?>
    </div>
    <?php if ( ! dynamic_sidebar( 'Header Banner' ) ) : endif; ?>

    I have added this in the functions.php:

    if (function_exists('register_sidebar')) {
    register_sidebar(array(
    'id' => 'header-widgets',
    'name' => 'Header widgets',
    'description' => 'Widget area below the header',
    'before_widget' => '<div id="%1$s">',
    'after_widget' => '</div>',
    'before_title' => '<h4>',
    'after_title' => '</h4>'
    ));
    }

    The problem is, when I add all of this code, the sidebar disappears and only nav menu shows, and when and when I remove the entire code the nav menu disappears and the sidebar retains. Please Help!

    There is some problem in the functions.php code. Could someone please help me out?!

Viewing 1 replies (of 1 total)
  • I think you are confusing menus with dynamic sidebars. It looks like you have registered a menu named ‘header banner’ and are trying to use it like a dynamic sidebar. They are very different things.

    Also, case matters. You have ‘header banner’ when you create the menu but ‘Header Banner’ when you appear to be trying to check for it.

    Also also, spaces can be problematic. I wouldn’t register anything as ‘header banner’. Use ‘header_banner’ instead.

Viewing 1 replies (of 1 total)
  • The topic ‘Problems after creating new widget area’ is closed to new replies.
Skip to toolbar