okay so I’m using the following code to get my links…
<?php wp_nav_menu( array('theme_location' => 'primary', 'container' => '', 'menu_class' => 'mainnav') ); ?>
This is my CSS for the nav…
.mainnav a {
font-family: gooddog_plainregular, Arial, sans-serif;
font-size: 30px;
color: #ffea00;
text-decoration:none;
}
.mainnav li:after {
content: url('images/nav-divider.png');
}
.mainnav li.last:after {
content: none;
}
.mainnav li {
list-style: none;
display: inline;
font-size: 30px;
margin-bottom: 10px;
}
.mainnav li.last {
list-style: none;
display: inline;
font-size: 30px;
margin-bottom: 10px;
}
The problem I’m having is that the li.last
doesn’t work, how do I add the class to it?
Thanks 🙂
Here’s a function I use to add a first / last class to
wp_nav_menu()
items:Developer Resources –
wp_nav_menu_objects
HookUse the last-child pseudoclass in the CSS:
The function mentioned by Howdee_McGee was great, but only seemed to work for menus without sub menu items. For a menu with sub menu items, try: