I have a navbar which is accessible by all the pages through header.php But I need different navbar for home page and different one for the rest of the pages.

I have made this navbar absolute and transparent for the home page by addidng css like this :

`

.navbar-inverse-blue .navbar-inner {
    padding: 7px 0;
    background: rgba(51, 51, 51, 0.3);
    border: none;
    font-size: 0.85em;
    position: absolute;
    z-index: 9999;
    width: 100%;
}

`

But in other page i want to change that navbar fixed and non-transparent and for that i have the css also

.navbar-inverse-blue .navbar-inner {
padding: 7px 0;
border: none;
font-size: 0.85em;
z-index: 9999;
width: 100%;

}

and this is my HTML CODE`

<div  id="nav-wrapper" data-spy="affix" data-offset-top="200"  class="navbar navbar-inverse-blue navbar">
<!--<div class="navbar navbar-inverse-blue navbar-fixed-top">-->
  <div class="navbar-inner">
    <div class="container">
       <div class="navigation">
         <nav id="colorNav">
           <ul>
            <li class="green">
                <a href="#" class="icon-home"></a>
                <ul>
                    <li><a href="login.html">Login</a></li>
                    <li><a href="register.html">Register</a></li>
                    <li><a href="index.html">Logout</a></li>
                </ul>
            </li>
           </ul>
         </nav>
       </div>
       <a class="brand" href="<?php echo esc_url(home_url('/')); ?>"><img src="<?php header_image(); ?>" alt="logo"></a>
       <div class="pull-right">
        <nav class="navbar nav_bottom" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
      <div class="navbar-header nav_2">
          <button type="button" class="navbar-toggle collapsed navbar-toggle1" data-toggle="collapse" data-target="#bs-megadropdown-tabs">Menu
            <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="#"></a>
       </div> 
       <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-megadropdown-tabs">


            <?php
        wp_nav_menu( array(
            'menu'              => 'primary',
            'theme_location'    => 'primary',
            'depth'             => 2,
            'container'         => 'div',
            'container_class'   => 'collapse navbar-collapse',
            'container_id'      => 'bs-example-navbar-collapse-1',
            'menu_class'        => 'nav navbar-nav nav_1',
            'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
            'walker'            => new WP_Bootstrap_Navwalker())
        );
    ?>
         </div><!-- /.navbar-collapse -->
        </nav>
       </div> <!-- end pull-right -->
      <div class="clearfix"> </div>
    </div> <!-- end container -->
  </div> <!-- end navbar-inner -->
</div>

But I dont’ know where to put that code. As i am calling header.php in every page.

Read more here: Different navbar in different page


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: