tags:

views:

78

answers:

4

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
A: 

How are you outputting it in your template? Is the menu being added through the admin panel or manually in the template?

awats
A: 

You can always use jQuery's :first and :last selectors ;)

kovshenin
+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
Yep, I think the easiest and not so bad variant is this one so I choose this way. Thanks.
Sergey Basharov