Quantcast
Channel: The Blog of Brady J. Frey
Viewing all articles
Browse latest Browse all 117

hacking wordpress: Unique id’s for the admin menu

$
0
0

One of the more troubling issues I had with wordpress is unique ID’s for the admin menu bar. I’m sure you’re asking why in the world I would need this:) — simply put, I wanted unique icons per admin area.

Steve Smith’s Tiger Admin tackled this issue with advanced CSS:


#adminmenu li a {}
#adminmenu li a.current {}

#adminmenu li + li a {}
#adminmenu li + li a.current {}

#adminmenu li + li + li a {}
#adminmenu li + li + li a.current {}

Etc, etc, problem was with this… I was hacking WordPress to work as a Content Management System — and in doing so, blocking some of the ill needed links from my daily users. By doing that, background icons would shift down to the next available #adminmenu li — thus, shifting the placement of my icons.

Tweaking the menu-header.php

In your root folder, go to the folder named ‘wp-admin’ and open the file ‘menu-header.php’.

In that file, lines 16 to 18 currently read:

echo "\n\t
  • {$item[0]}
  • "; else echo "\n\t
  • {$item[0]}
  • ";

    Since you already have a unique Item name, change those li’s to have an id and put the php item call in there:

    echo "\n\t
  • {$item[0]}
  • "; else echo "\n\t
  • {$item[0]}
  • ";

    And the output will be:

  • Welcome
  • Write
  • Manage
  • Presentation
  • Plugins
  • Users
  • Options
  • Import
  • You now have unique id’s per menu item, that allows you to use Excellent Icons Mark James to style your admin section like:

    DH administration

    DH admin login

    We could have just as easily adjusted the menu.php to add unique id’s, but I did not feel the need into messing with that anymore than I have, which I’ll explain shortly…


    Viewing all articles
    Browse latest Browse all 117

    Trending Articles