[wp-testers] adding class to first menu item when using wp_nav_menu()?

Jason Bobich jason_bobich at hotmail.com
Thu May 13 22:36:34 UTC 2010


In using "li:first-child", I guess the argument of supporting ie6 wouldn't pass for a good counter argument! However it still would be nice if there was title_li (or similar) parameter for the wp_nav_menu() function. 

> From: wp at andrewnacin.com
> Date: Thu, 13 May 2010 18:29:10 -0400
> To: wp-testers at lists.automattic.com
> Subject: Re: [wp-testers] adding class to first menu item when using	wp_nav_menu()?
> 
> li:first-child?
> 
> You can otherwise use an existing items filter I imagine, or add the class
> manually to the menu item. I see no reason to offer something that can
> otherwise be achieved in CSS however.
> 
> On Thu, May 13, 2010 at 6:26 PM, Jason Bobich <jason_bobich at hotmail.com>wrote:
> 
> >
> > Is it possible to add a class to the first menu item when showing a menu
> > with wp_nav_menu()?
> >
> > Or is there a way to completely remove the wrapping ul tag so my theme's
> > markup could be something like this:
> >
> > <ul>
> >    <li class="first"><a href="" title="">HOME</a></li>
> >    <?php wp_nav_menu(); ?>
> > </ul>
> >
> > Similar to how if you were using wp_list_pages you could do:
> >
> > <ul>
> >
> >    <li class="first"><a href="" title="">HOME</a></li>
> >
> >    <?php wp_list_pages('title_li='); ?>
> >
> > </ul>
> >
> > My main goal is trying to figure out a way to add special styling to the
> > first menu item, and I'm not sure if there's a way to go about doing this?
> > Any tips on this?
> >
> > Would be a cool feature if it's not already implemented to add a class to
> > the first menu item.
> >
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
 		 	   		  


More information about the wp-testers mailing list