I'm looking for a solution to adjust the output of
wp_nav_menu only on a specific navigation menu. I have my menu:
wp_nav_menu( array( "container" => "nav", "container_class" => "container", "container_id" => "nav", "fallback_cb" => false, "menu_class" => "six columns omega main-nav sf-menu", "theme_location" => "main-nav" ) );
I need to find a way insert
<span>[number]</span> inside of the anchor element.
[number] represents the number of the item starting at
1. Here's a visual:
The structure of the the menu would be:
<li class="..."> <a href="#"><span>01.</span>Home</a> </li> <li class="..."> <a href="#"><span>02.</span>Services</a> </li> <li class="..."> <a href="#"><span>03.</span>Portfolio</a> </li>
- wp_nave-menu(): Add span tags inside a tag that is parent — StackOverflow
- Understanding the Walker Class - Hub.TutsPlus.com
I have an idea that extending the walker class is necessary but my ultimate confusion lies with building the links manually and inserting dynamic information before link text is printed. The Stack Overflow question does it but does not explain how to get there.
To get the precise result that I wanted see pastebin.
$item->title needed to be modified in order to follow the HTML structure as listed above.