[wp-hackers] Hello, new developer with a question

Andy Staines andy at yellowswordfish.com
Sat Nov 17 23:58:56 GMT 2007


Well maybe I am doing something wrong - or, more likely - I have  
misinterpreted the question, but this works for me

function sf_admin_menu()
{		
	add_menu_page('Simple Forum', 'Forum', 8, 'sf-adminforums.php');
	add_submenu_page('sf-adminforums.php', 'Manage Forum', 'Manage  
Forums', 8, 'sf-adminforums.php');
	add_submenu_page('sf-adminforums.php', 'Manage Options', 'Manage  
Options', 8, 'sf-adminoptions.php');
}

gives a different 'name' to the first menu item even if it runs the  
same function.
Am  I wrong?
Andy

On 10:32  PM |  Sat 17 Nov 07, at 10:32  PM |  17 Nov 07,  
Viper007Bond wrote:

> add_menu_page() does indeed add a child with the same name and it  
> can be
> rather annoying.
>
> I have a ticket open on the matter: http://trac.wordpress.org/ 
> ticket/5100
>
> Meanwhile, you could probably "fix" this by modifying the $submenu  
> array.
>
> On 11/17/07, Callum Macdonald <lists.automattic.com at callum- 
> macdonald.com>
> wrote:
>>
>> Hey Derek,
>>
>> I'm pretty sure add_menu_page() doesn't add a child page. So you  
>> could
>> simply add a child page with the same page name and function, but a
>> different title.
>>
>> However, if it does add a child page automatically, hook into the
>> 'admin_menu' action and manually edit the $menu and $submenu  
>> variables.
>> You can see how they're structured in wp-admin/menu.php - it's pretty
>> straightforward.
>>
>> Cheers,
>>
>>
>> Callum.
>>
>> Derek Hogue wrote:
>>> Hey all,
>>>
>>> I'm just wrapping up work on my first WP plug-in, but there's one
>>> thing I can't figure out.
>>>
>>> I'm adding a top-level menu (as I have 5 child pages), but what I'd
>>> love to do is have the top-level menu name and the corresponding
>>> sub-level menu name be different - in the same way that clicking on
>>> "Write" takes you to the sub-menu called "Write Post".
>>>
>>> Is this doable within the plug-in API? Any ideas or help would be  
>>> grand.
>>>
>>> I've searched around, but can't find any discussion of this  
>>> online or
>>> in the archives of this list.
>>>
>>> Thanks!
>>> Derek
>>> --
>>> http://amphibian.info
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>
>
>
> -- 
> Viper007Bond | http://www.viper007bond.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list