php - Wordpress 4.0 - Broken menus -
i'm having problems getting custom menus work in wordpress 4.0. seems whatever worked before doesn't anymore, , i'm finding myself unable finish custom theme i've been working on due this. in theme, i'm supposed utilize 3 custom menues, appearing on same page (as header, main menu , footer menues). code goes follows:
on functions.php have this:
/*********************************************************************** ** registering menus used on site ** ***********************************************************************/ register_nav_menus( array( 'top_menu' => 'top header menu.', 'main_menu' => 'main site menu. allows dropdowns.', 'footer_menu' => 'footer menu', ) );
while, in order phone call menues on header.php , footer.php have this:
<?php wp_nav_menu( array('menu' => 'top_menu')); ?> <?php wp_nav_menu( array('menu' => 'main_menu')); ?> <?php wp_nav_menu( array('menu' => 'footer_menu')); ?>
this worked before wordpress 4.0 came along. won't work. can see menues in admin panel , set custom menues each spot, when open themes same menu on 3 places, when back-end states each menu has been set differently. doesn't create sense, , seems broken me.
furthermore, tried debugging issue changing menu calls to:
<?php wp_nav_menu( array('menu' => 'top_menu', 'theme_location' => '__no_such_location', 'fallback_cb' => false)); ?>
thus eliminating fallbacks menu. result? no menus printed whatsoever.
i've seen supposed 'fix' consists on putting aaa before menu names on admin, can't tell client custom theme and, then, that's hack tries around issue of wp menus not working setting menu absolute first one, , fear wouldn't work me anyway since need display 3 different menus on same theme.
am missing here? have been doing wrong along since started working wp, or did wp4.0 mess menues? there way around @ all, since aaa hack won't work need?
<?php wp_nav_menu( array( 'theme_location' => 'top_menu' ) ); ?>
when register navigation menu have done, you're setting theme location top_menu
, main_menu
, etc , that's need pass wp_nav_menu
- location. using menu registered through register_nav_menus
, can omit menu
parameter of wp_nav_menus
entirely.
php wordpress wordpress-theming
No comments:
Post a Comment