【发布时间】:2014-11-10 14:06:27
【问题描述】:
前几天我更新到 WP 4.0,发现我的菜单使用了第一个可用的字母菜单。我做了一些搜索,发现很多其他人也遇到了同样的问题。到目前为止,我在这个问题上看到的唯一答案是这里:
http://wordpress.org/support/topic/wp-40-broke-main-menu?replies=25
用户“lblechl”写道“验证您发送到 wp_nav_menu 的参数数组不包含任何尾随字符、多余的逗号、不正确的参数等。”
我浏览了我的主题,并将其与骨骼开发主题的原始版本进行了比较,但我似乎看不出问题出在哪里。有其他人经历过吗?
这是我正在使用的代码:
// REGISTERING THE MENU
function bones_theme_support() {
register_nav_menus(
array(
'mobile-nav' => __( 'The Mobile Menu', 'bonestheme' ) // main nav in header
)
);
}
// END REGISTERING THE MENU
// THE MENU
function bones_mobile_nav() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => '', // class of container (should you choose to use it)
'menu' => __( 'The Mobile Menu', 'bonestheme' ), // nav name
'menu_class' => '', // adding custom nav class
'theme_location' => '', // where it's located in the theme
'before' => '', // before the menu
'after' => '', // after the menu
'link_before' => '', // before each link
'link_after' => '', // after each link
'depth' => 0, // limit the depth of the nav
'fallback_cb' => 'bones_mobile_nav_fallback' // fallback function
));
}
/* END THE MENU */
// THE FALLBACK
function bones_mobile_nav_fallback() {
wp_page_menu( array(
'show_home' => true,
'menu_class' => '', // adding custom nav class
'include' => '',
'exclude' => '',
'echo' => true,
'link_before' => '', // before each link
'link_after' => '' // after each link
) );
}
/* END THE FALLBACK */
【问题讨论】: