Empty band appears on the header if no menu exists (WP 4.5.1)

Home Forums Menubar Forum Empty band appears on the header if no menu exists (WP 4.5.1)

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #7843 Reply
    JC De Vinatea
    Guest

    Hi Andrea, I have been using the plugin for a while, and is a “must-have” plugin for me, it’s very good. Therefore I decided to install it in all my webpages even if not needed right now, but maybe in the future.

    When I added to a webpage that don’t needed it (and therefore I created no menu), an empty back band appeared in the zone where usually appears the header menu. Then I realized that there is a function that I added in the header theme:
    <?php do_action('wp_menubar','HeaderMenu'); ?>
    I removed the instruction from the header.php and all worked ok.

    My question is: Is it possible to improve the code so it doesn’t generate anything if no menu exist? I mean, if I include the above sentence in the header but no menu has been created, then should display nothing, add no HTML code, so no black band is shown in the header.

    Hope you find my suggestion reasonable.

    I’m using WP 4.5.1, a Jelly (customized) theme.

    Thanks Andrea, and congratulations for an excellent plugin.

    Best regards,
    Juan Carlos

    #7844 Reply
    andrea
    Keymaster

    Hi Juan Carlos,

    When Menubar doesn’t find a menu, say ‘xyz’, it displays the message:

    WP Menubar error: Menu 'xyz' not found! Please create a menu named 'xyz' and try again.

    Probably your theme doesn’t show the message, but that message can help users that accidentally misspell their menu name, and I prefer not to remove it.

    Anyway you can easily remove the error message yourself. Open the file wpm-main.php, locate the lines 132-133:

    if ($menu == '')
        echo "<br /><b>WP Menubar error</b>:  Menu '$menuname' not found! Please create a menu named '$menuname' and try again.<br />\n";

    and replace them with:

    if ($menu == '') {}

    Hope this helps!

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Empty band appears on the header if no menu exists (WP 4.5.1)
Your information: