[wp-trac] [WordPress Trac] #14082: wp_nav_menu inserts newline char between <li>

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 25 08:23:39 UTC 2010


#14082: wp_nav_menu inserts newline char between <li>
--------------------------+-------------------------------------------------
 Reporter:  dmichalakos   |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  Menus         |     Version:  3.0       
 Severity:  normal        |    Keywords:  newline li
--------------------------+-------------------------------------------------
 Hello, I tried to create an inline menu, and found that wp_nav_menu
 inserts newline characters between the li tags.

 The result is leaving a space between the elements,
 i.e. list1 list2 list3 list4
 where it should be list1list2list3list4

 This is a quick fix:

 {{{
 $menu = wp_nav_menu(
     array(
             'theme_location'=>'language_menu',
             'container'=>null,
             'menu_id'=>'language-menu',
             'menu_class'=>null,
             'echo'=>0
         )
 );
 $menu = str_replace("\n", "", $menu);
 $menu = str_replace("\r", "", $menu);
 echo $menu;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14082>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list