From 86b856ee1b821f09280a7869780a9f345419bcd2 Mon Sep 17 00:00:00 2001 From: nacin Date: Mon, 3 May 2010 20:40:32 +0000 Subject: [PATCH] Truncate really long menu names. props koopersmith, see #13220. git-svn-id: http://svn.automattic.com/wordpress/trunk@14408 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/nav-menus.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 0e1917c0d1..06459ed088 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -302,6 +302,13 @@ if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) { $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : ''; } +// Generate truncated menu names +foreach( (array) $nav_menus as $_nav_menu ) { + $_nav_menu->truncated_name = trim( wp_html_excerpt( $_nav_menu->name, 40 ) ); + if ( $_nav_menu->truncated_name != $_nav_menu->name ) + $_nav_menu->truncated_name .= '…'; +} + // The theme supports menus if ( current_theme_supports('nav-menus') ) { // Set up nav menu @@ -353,7 +360,7 @@ require_once( 'admin-header.php' );