wordpress垂直显示导航栏菜单项

时间:2017-07-04 15:12:41

标签: wordpress custom-wordpress-pages codex

这是header.php的Y代码,但我无法理解为什么wp_nav_menu会给我一个垂直菜单。

enter image description here

这是我的header.php

代码
<div class="navbar-wrapper">

    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.html"><img src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/logo.png" alt="DevtechFreelancer"></a>
            </div>

            <?php
                wp_nav_menu( array(
                    'theme_location'    => 'primary',
                    'container'         => 'nav',
                    'container_class'   => 'navbar-collapse collapse',
                    'menu_class'        => 'nav navbar-nav navbar-right'
                ) );
            ?>

        </div>
    </nav>
 </div>

请帮助:我无法找到此错误的解决方案。

1 个答案:

答案 0 :(得分:0)

这是解决方案

<?php
                            wp_nav_menu( array(

                                'theme_location'    => 'primary',
                                'container'         => 'ul',
                                'container_class'   => 'navbar-collapse collapse',
                                'menu_class'        => 'nav navbar-nav navbar-right'

                            )   );
                        ?>