You may need to change this code ... but here is an example. You can see the Link to wp_nav_menu and add a hold pattern ... and later just change it using local replaces settings (see Array before replacement)
function main_nav() { $menu = wp_nav_menu( array( 'menu' => 'main_nav', 'theme_location' => 'main_nav', 'container_class' => 'menu clearfix', 'link_before' => '<span></span>', 'echo' => $false, 'fallback_cb' => 'bones_main_nav_fallback' ) ); $patterns = array( '<span></span><a href="home.php"', ); $replacements = array( '<span><img src="home.gif" /></span><a href="home"' ); echo str_repalce($patterns, $replacements, $menu); }
and btw, the list items contain the number of current classes, so you can use tham to track the current item in your menu.
source share