Closed Doocey closed 6 years ago
Hi, thanks for this question. This navwalker only adds the classes that you can't add yourself in a template. Here's a typical example using a Bootstrap navbar component from one of my themes:
<nav class="navbar navbar-expand-lg navbar-light">
<a class="logo navbar-brand" href="/"><img src="@asset('images/logo.png')" alt="{{ get_bloginfo('name') }}"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<div class="container">
<ul class="navbar-nav">
@if (has_nav_menu('primary_navigation'))
{!! wp_nav_menu($primarymenu) !!}
@endif
</ul>
</div> <!-- /.container -->
</div> <!-- /.collapse -->
</nav>
Since there are a million variations you might want to make to that code, and I don't want to make any assumptions about it, this walker only touches the HTML that WordPress tries to generate for you.
Does that help?
Thanks for the explanation. That makes sense! Just encountered a link your Discourse thread covering this, so apologies for what I'm sure is the millionth question on this you've been asked! :)
No problem. Glad you've got it working!
Hi there,
I have correctly installed and implemented this navwalker on a Sage 9 install (thanks for #1 - very timely!) and for my navigation output, it's a basic unordered list, however the dropdown for subpages is Bootstrap'd no doubt about it -- I'm just trying to figure if this navwalker is a complete Bootstrap Navbar or just specific to the dropdown?
Thanks!