Yup, nothing wrong with your two cents. But in this case, with not too large string to work with, and simply just getting rid of the classes and ID’s, my way should be a proper way.
Hi, new here. But I saw there was talk about “add a custom CSS class to an LI item”…
The best way to do this would be a jQuery selector.css at page load, in my opinion.
By the way.. in Norway we have a saying about “the shoes of the shoemaker’s children”. And the response utilities here could be better… can I say this ? ref http://www.bloghog.no
Me myself would rather be avoiding too much use of jQuery for what can be done server side. And adding css class to the menu is way simpler than using jQuery by using filter:
add_filter( 'nav_menu_css_class', 'filter_nav_menu_css_class', 10, 2 );
function filter_nav_menu_css_class( $classes, $item ) {
/* Do something here */
}