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

Daniel Bachhuber danielbachhuber at gmail.com
Sun Aug 1 01:21:04 UTC 2010


Oh, right.

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

On Jul 31, 2010, at 8:43 PM, Charles Frees-Melvin wrote:

> The first perametre is the filename of the parent that you want it  
> to be under e.g. uploads.php for Media
>
> --
> Charles E. Frees-Melvin
> charles at cefm.ca
> www.cefm.ca
> 506-640-1007
>
> Sent from my iPhone 3G
>
> On 2010-07-31, at 21:30, Daniel Bachhuber  
> <danielbachhuber at gmail.com> wrote:
>
>> Also related: I can access my taxonomies just fine if I hand-craft  
>> the URL (e.g. http://localhost:8888/wp-admin/edit-tags.php?taxonomy=user_role)
>>
>> Thanks,
>>
>> Daniel
>>
>> On Jul 31, 2010, at 5:35 PM, Mike Schinkel wrote:
>>
>>> Daniel:
>>>
>>> Is this what you are looking for?
>>>
>>> add_action('admin_menu', 'my_admin_menu');
>>> function my_admin_menu() {
>>>   add_menu_page('My Plugin Menu','My Plugin Menu',  
>>> 'manage_options', 'admin.php?action=my_plugins_action');
>>>   add_submenu_page('admin.php?action=my_plugins_action', 'Pitch  
>>> Statuses', 'Pitch Statuses', 'manage_options', 'edit-tags.php? 
>>> taxonomy=pitch_status');
>>>   add_submenu_page('admin.php?action=my_plugins_action', 'User  
>>> Types', 'User Types', 'manage_options', 'edit-tags.php? 
>>> taxonomy=user_type');
>>>   add_submenu_page('admin.php?action=my_plugins_action', 'User  
>>> Roles', 'User Roles', 'manage_options', 'edit-tags.php? 
>>> taxonomy=user_role');
>>> }
>>>
>>> Note, this assumes:
>>>
>>> 1.) You creates a custom post type for users that mirrors the user  
>>> (There is currently no way to create a taxonomy for a user),
>>> 2.) Your main plugin page is located in the admin at "admin.php? 
>>> action=my_plugins_action".
>>>
>>> -Mike
>>>
>>> On Jul 31, 2010, at 5:04 PM, Daniel Bachhuber wrote:
>>>
>>>> Hey all,
>>>> I'm creating a plugin that uses three custom taxonomies  
>>>> ('pitch_status', 'user_type', and 'user_role'). The first is tied  
>>>> to posts and the second and third are tied to users. I'd like to  
>>>> use add_submenu_page to add the edit screens for each of these  
>>>> taxonomies to the custom menu for the plugin. Is this possible?  
>>>> I'd prefer not to reinvent the wheel and have to create my own  
>>>> edit views.
>>>>
>>>> Thanks much,
>>>>
>>>> Daniel
>>>>
>>>> --
>>>> Daniel Bachhuber
>>>> www.danielbachhuber.com
>>>> danielbachhuber at gmail.com
>>>> cell: +1 971 998 5407
>>>> aim/skype/twitter: danielbachhuber
>>>>
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> --
>> Daniel Bachhuber
>> www.danielbachhuber.com
>> danielbachhuber at gmail.com
>> cell: +1 971 998 5407
>> aim/skype/twitter: danielbachhuber
>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

--
Daniel Bachhuber
www.danielbachhuber.com
danielbachhuber at gmail.com
cell: +1 971 998 5407
aim/skype/twitter: danielbachhuber



More information about the wp-hackers mailing list