I’m trying to add the ability to insert Custom CSS Classes to menu items. I believe I do this by extending the walker_nav_menu but I’m not sure how to call the custom classes.
This seems like such a simple question but I’ve googled and searched here and couldn’t find anything for simply adding the custom classes.
Right now I just have:
<?php wp_nav_menu( array( 'theme_location' => 'top-menu', 'walker' => new future_walker_class() ) ); ?>
and
class future_walker_class extends Walker_Nav_Menu {
/*not sure what to put here*/
}
P.S. I’m fairly new to PHP/Wordpress. I tried to be as thorough as possible so I don’t waste your time.
If its a matter of adding icons as per the classes, add it from the back-end and use that class to assign icons through css.
okay so based on your code it looks to me like you are working with a child theme, or maybe your own theme. — this answer is based on that assumption.
First things first, you need to register your (new) menu.
You will then need to assign location to the menu in
wp-admin > appearance > menus
Then you can style the custom walker
then when you are ready to call the new menu lets say in
header.php