In: , ,
On: 2008 / 08 / 21 Viewed: 15076 times

Update: I've update the plugin doc and added a page for plugin coders.

I've just committed version 2.3 of the mother of all admin menu plugins, Admin Drop Down Menu, and there are some pretty hot stuff inside. Plugin coders, be sure to read this till the end.

First, it's finally ready for translation. That's something I've been asked a few times, so now polyglots can rejoice since there is a .pot file included. I've also added CSS classes and id's to all menu elements so styling maniacs can hack their stylesheet to death.

The most visible change will be optional menu icons. That's something I've been nagged about a gazillion times, and that I had never added because, well, I don't need them :) So, why add them now, you ask? Because I had a fun idea to implement!

The cool stuff with this release is there is sort of an API to play with. The function that builds the array that builds the menu is full of hooks so that if your plugin needs, for some reason, to modify menu entries, you don't have to write dirty patches, just throw some add_filters() in (hat tip to Kevin Behrens and his plugin Role Scoper for inspiring this)

But wait, there's more, and cooler!

Icons are stolen from the awesome FamFamFam, of course. By default, plugins get a cute green plugin icon, but this can get a bit boring when you have dozens of plugin entries looking the same. Plugin coders want their individuality!

Well, they can have it: there's an awesomely super cool hook that allows plugins to have their own icon! (I'm pretty excited with this feature:)

To do so, simply add the following in your plugin:

PHP:
  1. add_filter('ozh_adminmenu_icon', 'myplugin_icon');
  2.  
  3. function myplugin_icon($hook) {
  4.     if ($hook == 'myplugin') return 'http://url/to/cute/icon.png';
  5.     return $hook;
  6. }

Where 'myplugin' is the $file argument used to add your administration page (for instance add_options_page('My Plugin', 'My Plugin', 10, 'myplugin', 'myplugin_do_stuff'))

If you use this cool feature in your plugin (or need help to do so) be sure to let me know!

Related posts

Metastuff

This entry "Admin Drop Down Menu: More Goodness & an API" was posted on 21/08/2008 at 2:47 am and is tagged with , ,
Watch this discussion : Comments RSS 2.0. You can trackback this post from your own site

14 Blablas

    Pages: [2] 1 » Show All

  1. 14
    Subscribe2 4.10 « Subscribe2 Plugi... United States »
    pingback on 20/Sep/08 at 8:06 pm # :

    [...] Added filter for Admin Drop Down Menu [...]

  2. 13
    Christina Warren United States »
    wrote, on 22/Aug/08 at 2:59 am # :

    Love the plugin, but weird glitch with the latest version -- after installing, I can't actually SEE anything but the top menu in my admin screen. It looks like it has loaded, but everything is just blank. I can go through the menus, but selecting anything doesn't actually load a page.

    I'll check some stuff with some of my plugins, and it is possible it is an incompatibility with something on my end, but I just wanted to give you a heads up in case anyone else starts to report a similar issue.

  3. 12
    ø OCPU 2.4.x - Cute Icons And Random Tw... United States »
    pingback on 21/Aug/08 at 10:00 pm # :

    [...] “Install a Plugin” and “Install a Theme”. (Writers block!) I used the new API of Ozh’s Admin Dropdown Menu plugin to add the icons, so make sure you install that fine [...]

  4. 11
    Matt Great Britain (UK) »
    wrote, on 21/Aug/08 at 8:58 pm # :

    Just found that about 10 seconds ago - you are a LEGEND :-)

Pages: [2] 1 » Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?

Close
E-mail It