[wp-trac] [WordPress Trac] #12718: Better structure for admin menu

WordPress Trac wp-trac at lists.automattic.com
Mon Jul 30 19:47:10 UTC 2012


#12718: Better structure for admin menu
------------------------------------+-----------------------
 Reporter:  scribu                  |       Owner:
     Type:  enhancement             |      Status:  reopened
 Priority:  normal                  |   Milestone:  3.5
Component:  Plugins                 |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+-----------------------

Comment (by soficgr):

 +1 really good work! I still look...

 it's possible add last seperator if not exist at wp-
 admin/includes/menu.php

 {{{
 function _add_admin_menu_classes () {
 ....
         // Remove the last menu item if it is a normal separator.
         $last = end( $items );
         if ( 'wp-menu-separator' == $last->class ) {
                 $admin_menu->remove( $last->id );
                 array_pop( $items );
         }
         // Add last separator if not exist
         if('separator-last' != $last->class){
                 $admin_menu->append( array(
                         'id' => 'separator-last',
                 'class' => 'wp-menu-separator',
                 ));
         }

 }}}

 I give the code because if $admin_menu have duplicated saparators at end
 you lost all saparators.

 {{{
         $admin_menu->append( array(
                 'id' => 'separator-4',
                 'class' => 'wp-menu-separator',
         ));
         $admin_menu->append( array(
                 'id' => 'separator-last',
                 'class' => 'wp-menu-separator',
         ));
 }}}


 also i think it's wasteful code if 1st check for "Remove any duplicated
 separators"
 and after "Remove the last menu item if it is a separator" maybe can join
 together


 The new admin menu class is really beautiful :D

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


More information about the wp-trac mailing list