0

On the menu, I'm talking about custom menus, I have a footer with several columns, each column will have a list of items, each column menus needs to be updatable from the menus option on wp admin, so I created the section on functions.php that calls the menus and also added each menu on the footer.php document, something like:

<?php wp_nav_menu( array('menu' => 'f-1', 'menu_class' => '', 'container' => 'nav' )); ?>
<?php wp_nav_menu( array('menu' => 'f-2', 'menu_class' => '', 'container' => 'nav' )); ?>
<?php wp_nav_menu( array('menu' => 'f-3', 'menu_class' => '', 'container' => 'nav' )); ?>
<?php wp_nav_menu( array('menu' => 'f-4', 'menu_class' => '', 'container' => 'nav' )); ?>

This is how I call the menus:

add_theme_support('nav-menus'); if ( function_exists('register_nav_menus')) {
register_nav_menus( array(
'main' => 'Main Nav',
'footer-noticias-financieras' => 'Footer Noticias Financieras',
'footer-otras-publicaciones' => 'Footer Otras Publicaciones',
'footer-foro' => 'Footer Foro'
) );
}

The thing is, when I place the menus using the theme menus area it prints automatically on my footer the column with 2 options, home and about, the "Automatically add new top-level pages" is not selected so not sure what's going on, anybody with the same problem?

Thanks so much!

A.-

1 Answer 1

0

You have created menu "placeholders" of sorts but you haven't added any actual menus yet, thus you see a kind of default menu being displayed.

  1. Go to wp-admin -> Appearance -> Menus
  2. Create a menu
  3. Assign the menu to one of your menu locations
  4. Add something to the menu
  5. Save

Now you should see the menu you expect.

To avoid printing a menu when there is no menu use has_nav_menu.

// var_dump(has_nav_menu('footer-noticias-financieras')); // debug
if( has_nav_menu('footer-noticias-financieras')) {
  wp_nav_menu( array('menu' => 'footer-noticias-financieras', 'menu_class' => '', 'container' => 'nav' ));
}

Notice how I am using the slugs you used and not the f-* values. I don't know where those come from.

5
  • Thank you! Actually I did that, but is not working it displays the menu as mentioned earlier, like if its empty it places pages. Not sure what else to do or where to look.
    – Arturo
    Commented Aug 5, 2013 at 20:46
  • I copied your code verbatum, registering in functions.php and pasting the rest into header.php, and then did what I explained. It worked fine. Without more information I don't know what else to say.
    – s_ha_dum
    Commented Aug 5, 2013 at 20:56
  • Yes, but see, when going step by step in your previous 5 points everything works, but if I add nothing to the menu then it drops the pages, I can create the menu and save it without adding any menu item, when I do this then the thing appears with page names populated.
    – Arturo
    Commented Aug 5, 2013 at 21:01
  • "... if I add nothing to the menu then it drops the pages..." -- that is correct, it is built that way. Give me a second.
    – s_ha_dum
    Commented Aug 5, 2013 at 21:17
  • Oh, I see, that explain everything I think..... :(
    – Arturo
    Commented Aug 5, 2013 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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