0

The title might not a 100%, feel free to correct...

I'm building a custom theme that has a couple of costume theme locations for menus (1 main menu, 1 footer menu, 1 "Follow Live" button). These are specified as a Theme Location in the Menu's panel.

I'm having an issue with the footer menu: when that theme location does not have a menu selected, it falls back to displaying all pages. I'd like it to not display anything when it's not linked to a menu.

The menu is defined in functions.php like this:

function add_footer() {
register_nav_menus(
    array('footer-menu' => __('Footer Navigation'),));} 
add_action('init', 'add_footer');

And it's displayed on the page like this:

    <?php
         wp_nav_menu( array(
        'theme_location' => 'footer-menu', 
        'menu_class' => 'false', 
        'container' => 'false', 
        'fallback_cb' => 'wp_page_menu', 
        ));?>

I've tried removing the fallback_cfoption but that doesn't help.

1

If you set fallback_cb to false, it will not show anything if the menu doesn't exist. The codex does a pretty great job of detailing the parameters of wp_nav_menu(), it's DEFINITELY worth a read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.