Error referencing SageNavWalker : "not found"

I’m in the process of moving a theme from an early version of sage to the newer version with Sass baked-in (was getting weird bootstrap padding anomalies on the manually sass-ported version I was working from).

Mostly works, but I’m getting weird errors related to the Sage nav walker.

Has the SageNavWalker been removed/changed? I’ve got a bunch of stuff built that hooks into the classes it generates, and don’t really want to refactor it all, so I’m hoping that I can get SageNavWalker working again.

Thanks,

T

1 Like

Hi There,

The nav walker has been moved to Soil.

1 Like

You mean this soil? https://roots.io/plugins/soil/

So I need an $18 USD plugin now to get the same output I had using the previous nav-walker?

I’m confused.

Purchasing Soil is encouraged for commercial purposes. The source is also available here: https://github.com/roots/soil

Nav Walker will always be in Sage git history as well: https://github.com/roots/sage/blob/9efeb67daffa477873d33adafd8b12386c4298ba/lib/nav.php

1 Like

Thanks @swalkinshaw — I’ll look at the source and see if I can get it working.

Re: the old navwalker: tried including the nav.php file from the old version of sage and it just throws function errors (namespacing problem? I’m new to the whole namespacing thing in php/sage, so there’s zero chance that I’m going to be able to shoehorn it back into a working state).

The file I linked has the namespace so that shouldn’t be an issue. Here’s the commit that removed everything: https://github.com/roots/sage/commit/64e78cf00336c77bd05b7b4af2351ee2de8ed156

Just need to do the reverse of it basically.

1 Like
1 Like

Additionally you could use a dedicated plugin for this functionality https://github.com/twittem/wp-bootstrap-navwalker

If one wanted to create his own custom NavWalker based on Soil’s new navwalker module, how would one go about extending the NavWalker class found in the Soil navwalker module? Currently I am trying with the following code and it is not able to find the class:

use Roots\Soil\Nav\NavWalker;

class Custom_NavWalker extends NavWalker {

}

Results in:
Fatal error: Class ‘Roots\Soil\Nav\NavWalker’ not found in /var/www/mk/public_html/app/themes/mk/lib/nav.php on line 5

1 Like

Did you ever find the issue with extending the NavWalker class? I’m getting exactly the same issue

1 Like