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.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks, the custom walker I was using seems to override the fallback default. –  robmathers Jun 25 at 4:15

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.