我在一本说明书的帮助下创建了一个自定义的wordpress设计,但在创建菜单时遇到了麻烦。
我应该在functions.php中输入以下代码
register_nav_menus( array(
'fomenu' => __( 'Fomenu', 'smaragdkerteszet' ),
'kismenu' => __( 'Kismenu', 'smaragdkerteszet' ),
) );之后,我应该能够转到管理面板中的外观/菜单,并在下拉列表中的2个菜单之间进行选择,但此列表不出现。
我需要修复什么?
发布于 2015-05-17 13:05:19
只需遵循以下代码:
function register_all_menu(){
register_nav_menus(
array('top_menu' => 'Top Menu')
);
}并在要显示导航菜单的位置添加"show_top_menu“。
Function show_top_menu(){
$topMenu = array(
'theme_location' => 'top_menu',
'container' =>'false',
'item_wraper' => '<ul id ="top_menu" class="%2$s">3$s</ul>'
);
wp_nav_menu($topMenu);
}发布于 2015-05-19 17:41:39
也许add_action可以提供帮助:
// Register your menus
function my_custom_menus() {
$locations = array(
'fomenu' => __( 'Fomenu', 'smaragdkerteszet' ),
'kismenu' => __( 'Kismenu', 'smaragdkerteszet' ),
);
register_nav_menus( $locations );
}
// Hook them into the theme-'init' action
add_action( 'init', 'my_custom_menus' );https://stackoverflow.com/questions/30280640
复制相似问题