wp-bootstrap / wp-bootstrap-navwalker

A custom WordPress nav walker class to fully implement the Twitter Bootstrap 4.0+ navigation style (v3-branch available for Bootstrap 3) in a custom theme using the WordPress built in menu manager.
https://wp-bootstrap.github.io/wp-bootstrap-navwalker/
GNU General Public License v3.0
3.37k stars 1.94k forks source link

navbar centered and auto width #206

Closed ghost closed 8 years ago

ghost commented 9 years ago

Hello, How to center my navbar and give it an auto width. My navbar has an image as a brand.

************************************************************************************
* logo | item | item | item | item                                                 *
************************************************************************************

I would like :

************************************
* logo | item | item | item | item *
************************************

but centered

Please and thanks in advance.

LouisMilotte commented 9 years ago

House the navbar in a grid.

ghost commented 9 years ago

Thanks for your answer. Can you modify my code below please for my comprehension

<nav class="navbar navbar-default" role="navigation">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
          <a title="Accueil" class="navbar-brand" href="<?= esc_url(home_url('/')); ?>">
            <img src="<?= esc_url(get_template_directory_uri() . '/dist/images/logo.png'); ?>">
          </a>
        </div>
        <?php
            wp_nav_menu( array(
            'menu'              => 'primary_navigation',
            'theme_location'    => 'primary_navigation',
            'depth'             => 2,
            'container'         => 'div',
            'container_class'   => 'collapse navbar-collapse',
            'container_id'      => 'bs-example-navbar-collapse-1',
            'menu_class'        => 'nav navbar-nav',
            'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',
            'walker'            => new wp_bootstrap_navwalker())
            );
        ?>
    </div>
</nav>
LouisMilotte commented 9 years ago

No, I cannot do your work for you.

Check the bootstrap guides for using their grid.