I am trying to change the markup for the nav on my site and I am pretty new to developing wordpress, but I am having issues getting it to display my Walker class. I am attempting to reconfigure the 2017 theme that comes with Wordpress. But I keep getting this error that says "Fatal error: Class 'Walker_Nav_Primary' not found in /wp-content/themes/Vibe/header.php on line 56" This is what the class looks like:
<?php
class Walker_Nav_Primary extends Walker_Nav_menu {
function start_lvl( &$output, $depth = 0, $args = array() ){ //ul
$indent = str_repeat("\t",$depth);
$submenu = ($depth > 0) ? ' sub-menu' : '';
$output .= "
$indent<ul class=\"dropdown-menu$submenu depth_$depth\">
";
}
/*
function start_el( ){ //li a span
}
function end_el(){ // closing li a span
}
function end_lvl(){ // closing ul
}
*/
}
And the portion of my header file where I am calling it:
<?php wp_nav_menu( array(
'theme_location' => 'top',
'menu_id' => 'primary-menu',
'menu_class' => 'head-menu',
'walker' => new Walker_Nav_Primary(),
) ); ?>
EDIT:
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'top' => __( 'Top Menu', 'twentyseventeen' ),
'social' => __( 'Social Links Menu', 'twentyseventeen' ),
) );