2016-12-16 46 views
0

我添加了額外的菜單的功能「頁腳菜單」:WordPress的頁腳位置問題

function register_theme_menus(){ 
    register_nav_menus(
    array(
     "header-menu" => __("Header Menu"), 
     "footer-menu" => __("Footer Menu") 
    ) 
); 
} 

下面是從footer.php代碼:

<?php 
     $args1 = array(
     "menu"  => "footer-menu", 
     "menu_class" => "nav navbar-nav", 
     "container" => "false", 
     "fallback_cb" => "wp_page_menu", 
     //Process nav menu using our custom nav walker 
     "walker" => new wp_bootstrap_navwalker() 
     ); 
     wp_nav_menu($args1); 
    ?> 

但是,當我在儀表盤定製,它仍然分配給標題菜單。可能是代碼問題,但我找不到任何解決方案。

enter image description here

也許有人有類似的問題?

回答

0

請將數組內的「menu」元素更改爲theme_location。

<?php 

    $args1 = array(
    "theme_location"  => "footer-menu", 
    "menu_class" => "nav navbar-nav", 
    "container" => "false", 
    "fallback_cb" => "wp_page_menu", 
    //Process nav menu using our custom nav walker 
    "walker" => new wp_bootstrap_navwalker() 
    ); 
    wp_nav_menu($args1); 

?> 
+0

謝謝你,你的救星。這裏是來自Wordpress CODEX的鏈接[link] https://developer.wordpress.org/reference/functions/wp_nav_menu/ [link]。可能它已經過時了。 – MrVitaminasG