No description, website, or topics provided.
Branch: master
Clone or download
MWDelaney Merge pull request #10 from jelovac/master
Improves the documentation in order to fix #4
Latest commit bf880b5 Feb 15, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bootstrap4-navwalker.php Update bootstrap4-navwalker.php May 31, 2018

Sage 9 friendly Bootstrap 4 Navwalker

Sets up a Bootstrap 4 Navwalker for Sage 9-based themes.

To install, run the following in your Sage9-based theme directory:

composer require "mwdelaney/sage-bootstrap4-navwalker"

Include the navwalker in your wp_nav_menu function:

As a Controller method (Recommended)

In your Controller, probably app.php

 * Primary Nav Menu arguments
 * @return array
public function primarymenu() {
  $args = array(
    'theme_location'    => 'primary_navigation',
    'menu_class'        => 'navbar-nav',
    'walker'            => new \App\wp_bootstrap4_navwalker(),
  return $args;

In your Blade file, probably header.blade.php

@if (has_nav_menu('primary_navigation'))
  {!! wp_nav_menu($primarymenu) !!}

Without Controller

If you're not setting up your template data with Controller, you'll need to fully reference the \App\wp_bootstrap4_navwalker(). In your Blade file, probably header.blade.php

@if (has_nav_menu('primary_navigation'))
  {!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'navbar-nav', 'walker' => new \App\wp_bootstrap4_navwalker()]) !!}