In: , ,
On: 2008 / 08 / 21 Viewed: 44503 times
Shorter URL for this post: http://ozh.in/iy

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:

  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!

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/iy

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.

24 Blablas

  1. JD Hartley says:

    Awesome! This is some pretty sweet stuff. I just hope that the plugin authors will catch on right away. The green icons will probably get annoying pretty fast…

    Keep it coming, Ozh!

    -JD

  2. Les says:

    Nice development, but one slight problem. If used with Fluency Admin, the icons slightly overlap the text on the menus.

  3. Ozh says:

    Les » That's something to be fixed on the Fluency side, then. Or: don't enable the icons :)

  4. Hi,

    thanks for the update. I like the icons and think it makes the menu's better in a way.

    Please keep up the good work and thanks again.

  5. armouf says:

    Ok, ozh nice update but you got to step forward.

    Simply buy fluency and you could merge it with your plugin so we dont need to expect a new version of fluency everytime you udpate your plugin and vice versa :)

  6. Matt Algren says:

    Love the plugin as always. You have no idea how much time this saves me. But…

    I turned off the icons (until I can get some icons on other plugins), and it works fine except in the case of the Settings dropdown line for Admin Menu. On that item it shows your icon over and over.

    I'm doing a horrible job explaining it, so here's a picture. I've done this on both my blogs, and I get the same result.

    http://betterlate.files.wordpress.com/2008/08/admin-menu.jpg

  7. Stephen R says:

    Aha, here it is!

    Nice. JavaScript Pull-Quotes is totally getting an icon. I already have the image, from an ill-fated attempt to make a Rich-Text pull-quote button. :)

  8. Ozh says:

    Matt & Eyn » stupid little bug fixed in 2.3.1, thanks for the feedback :)

  9. Matt says:

    Ozh,

    Lovinh the new plugin and want to make use of the API – but my plugin adds menus using '__FILE__'. How should I add into your API?

  10. Ozh says:

    Matt » I've *just* updated the plugin doc and added a page for coders :)
    Basically, you need to test on plugin_basename(__FILE__)

  11. Matt says:

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

  12. […] "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 […]

  13. 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.

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

  15. Astropeg says:

    I need some help… I am not a code writer/programmer/webmaster (though I am learning :-)

    I installed the drop down menu on several websites. I love it but it is affecting the page display of 2 of the websites. One is: http://mattpapanek.com/

    My webmaster is not familiar with the plugin and suggested just uninstalling it. After uninstalling the plugin, the page display is still affected. This has happened on 2 different sites. I reinstalled the plugin.

    Before going back to the webmaster, I would like to know if there is a solution because, well, I love this plugin!

    Any help would be greatly appreciated!

  16. Ozh says:

    Astropeg » "After uninstalling the plugin, the page display is still affected." so obviously my plugin does not interfere with whatever you call "affecting the page display"

  17. Astropeg says:

    Thank you for responding so fast Ozh!

    Actually, there were no problems with the public view of the page display on either site until I installed the plugin. This seems odd to me since the plugin is for admin page functionality.

    When I installed the plugin, I did not do anything else except select a color for the menu bar and check the box to hide the speech bubbles. I did nothing else but install your great plugin.

    I really love this plugin and am hoping to find a solution.

    Thank you again for your fast response and your help! Oh, and I wanted to donate but the paypal page came up in French…

  18. Astropeg says:

    Is it possible that the plugin may have affected some of the code in the Theme/template files? I do not know what to look for because I am not a code writer/webmaster and I may not be communicating this correctly but it seems that the size of the image files for the header and top of the page have been affected. I am using the Thesis theme as well as custom headers.

    Again, 2 sites were affected in the same way following the installation of the plugin:
    http://mattpapanek.com/
    http://lunafengshui.com/

    Thank you again for your time Ozh!

  19. Ozh says:

    Astropeg » if you deactivate the plugin, it's deactivated for good. It does not "affect" code. Plus, my plugin does nothing to the public part of the blog. Actually it does not even load in memory when you're not viewing the admin area.

  20. Astropeg says:

    This is all very strange then. I am not sure how 2 different sites could be affected the same way when the plugin was installed and uninstalled.

    Do you have any suggestions? Can you help me? I would really like to be able to use your plugin on the 2 mentioned sites.

    I do appreciate you taking the time to help me.

  21. Ozh says:

    Astropeg » the thing is: the plugin cannot "affect" the public part. It is coded so that it simply does not load when viewing the public part. Thus, I'm afraid I can't help, sorry.

  22. Astropeg says:

    Thanks for taking the time to respond Ozh, I will get to the bottom of this because I don't want to ever be on a wordpress admin page without your plugin. It should be part of the core of wordpress as many folks have mentioned on other forums. It truly is my favorite plugin and every time I see the menu bar I smile! Thanks again.

  23. David says:

    That's a pretty cool plugin =)
    Nice.

  24. Bill says:

    Your plugin looks great…I am still on WP 2.7. Does it play nice with the latest WP version?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.

Read more ?