Skip to content

Instantly share code, notes, and snippets.

Created April 29, 2015 04:55
What would you like to do?
Sage header template for Bootstrap top navbar component
// This file assumes that you have included the nav walker from
// somewhere in your theme.
<header class="banner navbar navbar-default navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only"><?= __('Toggle navigation', 'sage'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<a class="navbar-brand" href="<?= esc_url(home_url('/')); ?>"><?php bloginfo('name'); ?></a>
<nav class="collapse navbar-collapse" role="navigation">
if (has_nav_menu('primary_navigation')) :
wp_nav_menu(['theme_location' => 'primary_navigation', 'walker' => new wp_bootstrap_navwalker(), 'menu_class' => 'nav navbar-nav']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment