Hi,
The way you do it is by changing the number after $output to the number of times you want the function to happen (-1 for unlimited); so if you want the function to do it for every menu item it looks like this:
function add_nav_class($output) {
$output= preg_replace(‘/<a/’, ‘<a class=”your-class”‘, $output, -1);
return $output;
}
add_filter(‘wp_nav_menu’, ‘add_nav_class’);