Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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