How can I add some class to the first and the last item in the menu?
A:
The Wordpress Codex has all info you need. But I assume that you're looking for the wp_nav_menu function. However; as far as I know; it's not possible to specify a different class to only the first and last menu items.
Rhapsody
2010-10-15 13:16:19
A:
How are you outputting it in your template? Is the menu being added through the admin panel or manually in the template?
awats
2010-10-18 19:16:18
+1
A:
The jQuery solution is the easy one:
Add this to your script file:
$("ul li:first").addClass("first");
$("ul li:last").addClass("last");
stffn
2010-10-19 12:58:54
Yep, I think the easiest and not so bad variant is this one so I choose this way. Thanks.
Sergey Basharov
2010-10-22 20:19:20