There’s no constructor, so it’s not available as a property of the class, but each method in the class receives the arguments passed to wp_nav_menu()
as an object. For example, start_lvl()
:
/**
* Starts the list before the elements are added.
*
* @since 3.0.0
*
* @see Walker::start_lvl()
*
* @param string $output Used to append additional content (passed by reference).
* @param int $depth Depth of menu item. Used for padding.
* @param stdClass $args An object of wp_nav_menu() arguments.
*/
public function start_lvl( &$output, $depth = 0, $args = array() ) {
if ( 'special_menu' === $args->theme_location ) {
// Do something.
}
}
Yes, the default value for $args
is an array, but nav walkers receives it as an object, for some reason.
The other methods also make the arguments available, but not necessarily as the 3rd argument. You’ll need to see which parameters are passed to each method, but you need to do that when extending a class anyway.