Wordpress页脚位置问题

时间:2016-12-16 04:43:07

标签: wordpress-theming

我添加了额外的菜单来实现“页脚菜单”功能:

  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

也许有人有类似的问题?

1 个答案:

答案 0 :(得分: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);

?>