I have a downloaded theme and it where the wp_nav_menu is created it looks something like this:
<div class="nv-nav-wrap">
<div role="navigation" class="<?php echo esc_attr( join( ' ', $container_classes ) ); ?>"
aria-label="<?php esc_attr_e( 'Primary Menu', 'neve' ); ?>">
<?php
echo wp_nav_menu(
[
'theme_location' => 'primary',
'menu_id' => $menu_id,
'menu_class' => 'primary-menu-ul nav-ul' . $additional_menu_class,
'container' => 'ul',
'walker' => '\Neve\Views\Nav_Walker',
'fallback_cb' => '\Neve\Views\Nav_Walker::fallback',
'echo' => false,
]
);
?>
</div>
</div>
I've created a child theme and I want to change the walker of the wp_nav_menu. How can I do that? The new walker's name is "Aria walker Nav menu" (just for reference)
I've tried putting this in functions.php in the child theme:
wp_nav_menu( array(
'theme_location' => 'primary',
'container' => false,
'menu_class' => 'primary-menu-ul nav-ul',
'walker' => new Aria_Walker_Nav_Menu(),
'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
) );
But it creates a whole new menu. How do I just replace the walker for the original one in the theme
functions.php
is not the place to putwp_nav_menu
calls, are you familiar with how child themes templates work?