wharfdale
wharfdale

Reputation: 752

Class not found - extending Walker_Nav_Menu

I have a composer package installed for adding BEM naming to my menu classes etc. - https://packagist.org/packages/craigpearson/bem-walker-nav-menu - https://github.com/craigpearson/bem-walker-nav-menu

I've had this installed for about 1.5 years without issue/error. With no recent changes I am suddenly getting the following on a composer install:

Fatal error: Class 'Walker_Nav_Menu' not found in /Users/jordancharters/code/devtesting/devtesting.com/testing/site/web/app/themes/mytheme/vendor/craigpearson/bem-walker-nav-menu/walker.php on line 5

The following is in the walker.php file of the composer file.

<?php

namespace CP\BEM;

class navWalker extends \Walker_Nav_Menu

As we have \ it should be using the class as declared in the WordPress core. I tried with App\Walker_Nav_Menu too, no luck. I tested this because with Roots.io which I am using, my functions are all under the App namespace, but WordPress ones should be root anyway so no namespace needed.

Note: I am using roots.io too.

Upvotes: 0

Views: 1139

Answers (1)

Veks
Veks

Reputation: 21

Here is the solution for you.

namespace CP\BEM;

use \Walker_Nav_Menu;

class navWalker extends \Walker_Nav_Menu

Upvotes: 2

Related Questions