我目前正在Wordpress中创建页眉和页脚。
[当我使用wp_nav_menu并使用主主题位置时。我正在尝试抓住标题。我已在functions.php中将其设置为主。
但是最终显示我的页脚。
我还将菜单中的显示位置设置为“页眉”。我想念什么吗?
header.php
<?php
wp_nav_menu( array(
"theme-location" => "primary",
"container" => "ul",
"menu_class" => "navbar-nav mr-auto"
));
?>
functions.php
function kraken_theme_setup(){
add_theme_support( "menus" );
register_nav_menu( "primary", "Primary Header Navigation" );
register_nav_menu( "secondary", "Footer Navigation");
}
add_action( "after_setup_theme", "kraken_theme_setup" );
您在wp_nav_menu参数中有错字。
[theme-location
应该是theme_location
和_
除此之外,一切似乎都还可以。