[wp-hackers] Adding custom taxonomies as submenus to custom admin top-level menu

Mike Schinkel mikeschinkel at newclarity.net
Sun Aug 1 01:48:58 UTC 2010


On Jul 31, 2010, at 9:21 PM, Daniel Bachhuber wrote:
> Here's what I ended up doing:
> 
> http://plugins.trac.wordpress.org/changeset/270119/assignment-desk
> 
> It's not ideal that the menu items don't show up under our custom menu but this is functional enough for the time being (especially because I'll need to do a bit more hacking to get taxonomies to work with Users).
> 
> Thanks for your help,
> 

Daniel

Try this (integrated into your code, of course):

class AssignmentDesk {
	static function on_load() {
		add_action('admin_action_assignment-desk',array(__CLASS__, 'general_settings'));
		add_action('admin_menu', array(__CLASS__,'admin_menu'));
	}
	function general_settings() {
		echo 'Do your settings here';
	}
	static function admin_menu() {
		add_menu_page('Assignment Desk', 'Assignment Desk','manage_options','assignment-desk',array(__CLASS__, 'general_settings'));
		add_submenu_page('assignment-desk', 'Pitch Statuses', 'Pitch Statuses', 'manage_options', 'edit-tags.php?taxonomy=pitch_status');
		add_submenu_page('assignment-desk', 'User Types', 'User Types', 'manage_options', 'edit-tags.php?taxonomy=user_type');
		add_submenu_page('assignment-desk', 'User Roles', 'User Roles', 'manage_options', 'edit-tags.php?taxonomy=user_role');
	}
}
AssignmentDesk::on_load();

-Mike
P.S. I notice Assignment Desk the other day.  Planning to watch your progress, good luck!



More information about the wp-hackers mailing list