Creating Walker class to style main menu bar gives unknown error

[ad_1]

I’m trying to create a Walker class to style my top main menu bar. I’m following this guide and code sample:
https://www.youtube.com/watch?v=ArEmwJV6M7s
https://github.com/Alecaddd/WordPress101/blob/master/lesson_14/inc/walker.php

When I implement it on my website using below code snippets, I consitently get the following error:

enter image description here

English translation from Dutch:
“A critical error has occurred on this site. Check your site administrator email inbox for instructions. Learn more about troubleshooting issues in WordPress.”

Code

functions.php

require get_template_directory() . '/inc/walker.php';

walker.php

<?php
/* Collection of Walker classes */

class MeterInsight_Menu_Walker extends Walker_Nav_Menu {
    function start_lvl(&$output, $depth=0, $args=null) { //ul
        $indent = str_repeat("\t",$depth);
        $submenu = ($depth > 0) ? ' sub-menu' : '';
        $output .= "\n$indent<ul class=\"dropdown-menu$submenu depth_$depth\">\n";
    }

    function start_el(&$output, $item, $depth=0, $args=[], $id=0) {
    }

    function end_el() {
    }

    function end_lvl() {
    }
}
?>

menu.php:

<?php
wp_nav_menu(
    array(
        'theme_location' => 'primary',
        'menu_class' => 'navbar-nav ms-auto',
        'container' => 'nav',
        'container_class' => 'collapse navbar-collapse',
        'menu' => 'primary',
        'walker' => new MeterInsight_Menu_Walker()
    )
);
?>

How can I fix this? Or where can I get a more elaborate error message?

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer