[wp-trac] [WordPress Trac] #14250: wp_nav_menu separator and first last class

WordPress Trac wp-trac at lists.automattic.com
Wed Sep 22 23:50:03 UTC 2010


#14250: wp_nav_menu separator and first last class
-----------------------------+----------------------------------------------
 Reporter:  spathon          |       Owner:                 
     Type:  feature request  |      Status:  new            
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:                 
 Severity:  normal           |    Keywords:  wp_nav_menu    
-----------------------------+----------------------------------------------

Comment(by trilibi):

 Here is a little filter I use to help with first and last.


 {{{
 function nav_menu_first_last( $items ) {
         $position = strrpos($items, 'class="menu-item', -1);
         $items=substr_replace($items, 'menu-item-last ', $position+7, 0);
         $position = strpos($items, 'class="menu-item');
         $items=substr_replace($items, 'menu-item-first ', $position+7, 0);
         return $items;
 }
 add_filter( 'wp_nav_menu_items', 'nav_menu_first_last' );
 }}}


 @hakre - You are correct on the lack of support for the first/last pseudo
 selectors.  Probably less then half of the browsers out there support it.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14250#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list