php - Adding different unique classes to Wordpress wp_nav_menu? -
i'm trying put in different <img>
tags in each <li>
generated wp_nav_menu()
.
meaning want wp_nav_menu
generate this:
<ul id="main-menu"> <li id="menu-item-219" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-219"> <a href=""> <img id="icon-one" /> link 1 </a> </li> <li id="menu-item-220" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-220"> <a href=""> <img id="icon-two" /> link 2 </a> </li> </ul>
instead of (the original output):
<ul id="main-menu"> <li id="menu-item-219" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-219"> <a href=""> link 1 </a> </li> <li id="menu-item-220" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-220"> <a href=""> link 2 </a> </li> </ul>
so far i'm trying $link_before
parameter generating both of them @ same time, meaning doing <img id="icon-one" /><img id="icon-two" />
in middle of <a>
tag.
now i'm looking @ walkers, i'm wondering if there's clearer way it, , how?
i go pure css solution , apply image background image. this:
#main-menu > li.menu-item:nth-child(1) > { /* 1st background image here */ } #main-menu > li.menu-item:nth-child(2) > { /* 2nd background image here */ }
no need mess php code simple display issue.
Comments
Post a Comment