search field and right nav
Thank you for great work. I want to add search box and right aligned link items to menu look like bootstrap example > http://getbootstrap.com/components/#navbar
how to do that?
Here:
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<!-- 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-ex1-collapse">
<span class="sr-only"><?php _e( 'Toggle navigation', 'textdomain' ); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="<?php bloginfo( 'url' ); ?>">
<?php bloginfo( 'name' ); ?>
</a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<?php
wp_nav_menu(
array(
'theme_location' => 'main-menu',
'depth' => 2,
'container' => false,
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker()
)
);
?>
<form method="get" class="navbar-form navbar-left" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label for="navbar-search" class="sr-only"><?php _e( 'Search:', 'textdomain' ); ?></label>
<div class="form-group">
<input type="text" class="form-control" name="s" id="navbar-search" />
</div>
<button type="submit" class="btn btn-default"><?php _e( 'Search', 'textdomain' ); ?></button>
</form>
</div>
</div>
</nav>
Thanks @claudiosmweb!
A duplicate of issue #47, seems that search forms on the nav bar are very popular these days lol
I use a lot with my theme framework http://wpod.in/demo/ xD
Oh neat! I didn't know you have a framework, nice work!
Thank you very much I can use this draft, but there is no right nav items look like bootstrap example
If you want left & right nav with a search box in the middle, you will have to use two menus.
You will have to add an additional wp_nav_menu declaration after the form.
Here is an example of a right aligned menu.
<?php
wp_nav_menu(
array(
'theme_location' => 'main-menu-right',
'depth' => 2,
'container' => false,
'menu_class' => 'nav navbar-nav navbar-right',
'fallback_cb' => 'wp_bootstrap_navwalker::fallback',
'walker' => new wp_bootstrap_navwalker()
)
);
?>
Excellent, Thank you