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. 1
    JD Hartley United States »
    said, on 21/Aug/08 at 2:55 am # :

    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. 2
    Les United Kingdom »
    replied, on 21/Aug/08 at 9:00 am # :

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

  3. 3
    Ozh France »
    replied, on 21/Aug/08 at 9:09 am # :

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

  4. 4
    George Serradinho South Africa »
    wrote, on 21/Aug/08 at 10:42 am # :

    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. 5
    armouf France »
    wrote, on 21/Aug/08 at 12:27 pm # :

    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. 6
    Matt Algren United States »
    commented, on 21/Aug/08 at 4:35 pm # :

    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. 7
    Stephen R United States »
    thought, on 21/Aug/08 at 6:46 pm # :

    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. 8
    Ozh France »
    said, on 21/Aug/08 at 6:58 pm # :

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

  9. 9
    Matt United Kingdom »
    said, on 21/Aug/08 at 8:21 pm # :

    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. 10
    Ozh France »
    commented, on 21/Aug/08 at 8:52 pm # :

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

  11. 11
    Matt United Kingdom »
    commented, on 21/Aug/08 at 8:58 pm # :

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

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

  13. 13
    Christina Warren United States »
    commented, 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.

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

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

  15. 15
    Astropeg United States »
    said, on 13/Mar/10 at 12:16 pm # :

    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. 16
    Ozh France »
    wrote, on 13/Mar/10 at 12:22 pm # :

    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. 17
    Astropeg United States »
    wrote, on 13/Mar/10 at 12:51 pm # :

    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. 18
    Astropeg United States »
    replied, on 13/Mar/10 at 2:00 pm # :

    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. 19
    Ozh France »
    commented, on 13/Mar/10 at 2:29 pm # :

    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. 20
    Astropeg United States »
    commented, on 13/Mar/10 at 2:53 pm # :

    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. 21
    Ozh France »
    commented, on 13/Mar/10 at 7:16 pm # :

    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. 22
    Astropeg United States »
    replied, on 13/Mar/10 at 10:56 pm # :

    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. 23
    David Australia »
    replied, on 12/Jul/11 at 5:11 pm # :

    That's a pretty cool plugin =)
    Nice.

  24. 24
    Bill United States »
    commented, on 28/Nov/11 at 6:19 pm # :

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

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 ?