Skip to content Skip to tags Skip to twitter news Skip to blog roll Skip to categories Skip to archives Skip to recent posts

November 23, 2008


New Plugin Icon in WordPress 2.7

by in Tips,Wordpress on November 23, 2008 @ 12:00 pm

If you are a WordPress plugin Developer then you most likely have used the “add_menu_page” function before.  With WordPress 2.7 you can now add an icon to your plugin to be shown in the new side menu in the admin area.

  1. add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' )

So in PhotoXhibit’s case, I did the following:

  1. add_menu_page('PhotoXhibit','PhotoXhibit', 7, $bp, array(&$this, 'showLandingPage'), $this->imgBaseUrl.'lphoto.png');

And I get:

back to beginning of this post back to skip to links

If you liked this article why don't you share it:

Stumble it delicious Digg it Reddit it DZone it Bump it Mixx it! Buzz up! E-mail

3 Responses to “New Plugin Icon in WordPress 2.7”

Could you give a plainer example please? I don’t know what is returned by “$this->imgBaseUrl.’lphoto.png'” Are we supposed to put the full URL there?

Also, does this just work for top-level menu items or for submenus too?

Stephen, sure:

  1. add_menu_page('Page Title', 'Menu Title', Access Level, File , function, 'full/path/to/icon');

Take a look at the following like for decent explaination of what the first five variables are about:

For the last one, ‘full/path/to/icon’, that is simply the full path to where your icon will reside. In my example the $this->imgBaseUrl.’lphoto.png’ echos out to something like:

To answer your second question, no, icons are only top level and only in WordPress 2.7 which will be release this Thursday.

Thank you for this information. :)

Learn from my mistakes, I got burnt by the flame, you don't have to.

RSS Feed Link My Hosting of Choice

70 queries. 0.467 seconds. Powered by WordPress visitor stats