This is what I need to do. Using a menu, if a parent has children, I want to code this:
<li> <a href="#" class="my-parent-class">Name of term</a> <div class="caret"></div> <ul class="my-child-class"> <li> <a href="...">Name of child term</a> </li> ... </ul> </li>
So, it’s basically a clean format. I need to act a specific class to the link, a div after the link and remove all classes from the children links.
I managed to add a class to the parent -a- tag with this trick, last post.
I was also able to remove the link to the parent removing the proper taxnomy parent in the menu and replacing it with a “link” menu element.
I also changed the “sub-menu” class that the nav-menu-template.php added and changed it to “my-class”. I figured that this is short sighted, but it works.
So… up to this point this is what I have:
<li class="useless--bunch--of--classes> <a href="#">Name of term</a> <ul class="my-child-class"> <li id="useless--id" class="useless--bunch--of--classes"> <a href="...">Name of child term</a> </li> ... </ul> </li>
But I still cannot find any way to add a simple <div> after the link of the parent. I’d use it as an arrow to show the user that it’s a collapse menu.
- The topic ‘IF menu item is a parent THEN add bits and pieces to menu’ is closed to new replies.