Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am going crazy with the following WordPress custom theme that use BootStrap CSS framework: http://onofri.org/WP_BootStrap/

As you can see I have a problem with the horizontal main menu in my header.

To create the WP dynamic main menu having the classic BootStra style I use the wp-bootstrap-navwalker.php class inserting it in my theme following its documentation that you can read it: https://github.com/twittem/wp-bootstrap-navwalker

So, according to the previous documentation, I have perform the following operations:

1) I have put the ** wp_bootstrap_navwalker.php** class inside the root of my custom theme

2) I have require it in my functions.php file, putting in it the following code:

// Register Custom Navigation Walker
require_once('wp_bootstrap_navwalker.php');

3) In my header.php file I have insert the following code:

<body>
    <!-- Header e barra di navigazione -->
    <header>
        <nav class="navbar navbar-default">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="container">

                <div class="navbar-header">

                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">

                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>

                    <a class="navbar-brand" href="<?php echo home_url(); ?>">
                        <?php bloginfo('name'); ?>
                    </a>
                </div>

                <?php
                    wp_nav_menu(array(
                        'menu' => 'primary', 
                        'theme_location' => 'primary', 
                        'depth' => 2,
                        'container' => 'div', 
                        /*'container_class' => 'navbar navbar-default',*/
                        'menu_class' => 'nav navbar-nav', 
                        'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 
                        'walker' => new wp_bootstrap_navwalker())
                    );
                ?>

            </div>
    </nav>
    </header><!-- /header -->

4) And finnally I have register the nav menu in my theme putting this code into my functions.php file:

register_nav_menus(array(
    'primary' => __('Primary Menu', 'THEMENAME'),
) );

Ok, as you can see I can see the main menu but I see it twice: one is the correct visualization (the one with red background) but appear a second main menu upper and I can't understand why (I never declared it twice)

Do you have some idea about this issue? How can I try to solve?

Tnx

Andrea

share|improve this question
    
If when you use the default walker and it shows only one menu then the problem is with the walker class you added. –  Mark Kaplun Jan 24 at 10:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.