0

I'm trying my hand at developing a custom theme, and I've got navigation menus working (with the help of this walker, but only if they're explicitly defined in the menu settings.

The default themes (twentyfourteen, twentythirteen) seem to be able to create a default menu solely from the existing pages hierarchy, without needing to create a separate menu structure. I've had a look around the source for the twentyfourteen theme, but as far as I can tell, the menu is generated with a standard wp_nav_menu call. I don't see anything that accounts for how it loads a menu when none are defined.

Does anyone know how I can automatically populate my menus as the default themes do?

1 Answer 1

1

The default wp_nav_menu arguments set the fallback_cb argument to wp_page_menu, which outputs a list of pages if your menu doesn't exist. If your menu doesn't behave this way, that argument has been overridden in some way, either from being explicitly set in the wp_nav_menu call, or perhaps via the wp_nav_menu_args filter.

1
  • Thanks, the custom walker I was using seems to override the fallback default.
    – robmathers
    Jun 25, 2014 at 4:15

Your Answer

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

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