[wp-hackers] add_menu_page, icon, dynamic menu, css and plugin
Aaron D. Campbell
aaron at xavisys.com
Mon Dec 8 17:36:06 GMT 2008
I did something very similar recently, here's how I did it:
First, I set $this->_file in my class to the file for the main menu
item, then I do this:
add_menu_page( __('Page Title'), __('Menu Title'), 'accessLevel',
$this->_file, '', 'div');
...
public function adminCSS() {
echo <<<CSS
<style type="text/css">
#toplevel_page_{$this->_file} .wp-menu-image {
background:transparent url(images/menu.png) no-repeat scroll
-1px -1px;
}
</style>
CSS;
}
...
add_action( "admin_print_scripts", array($this, 'adminCSS') );
That should take care of it.
More information about the wp-hackers
mailing list