[wp-hackers] Top level menus with different submenu titles

Viper007Bond lists at viper007bond.com
Thu May 18 20:21:39 GMT 2006


Ooo, I'll try that. Thanks. :)

-Viper

Ryan Scheuermann wrote:
> I've done this without removing it later.   You just have to create the 
> submenu item first, and then add the top level menu right after it using 
> the same filename and function combination.  This will even keep the 
> first submenu highlighted when you click on the top level menu.
> 
> add_submenu_page("myfile.php",'First Submenu','First 
> Submenu',"do_stuff", "myfile.php", 'first_sub_page' );  
> add_menu_page('Menu Tests', 'Menu Tests',"do_stuff","myfile.php", 
> 'first_sub_page');
> 
> add_submenu_page("myfile.php",'Second Submenu','Second 
> Submenu',"do_stuff",'new_page_name', 'second_sub_page');
> 
> My example assumes you're using functions in 1 file for each page, of 
> course.  There is some quirky reason why this works and I remember 
> really investigating the code for the reason, but I can't remember it at 
> this moment.  This was a few months ago...
> 
> Hope that helps.  :-)
> 
> Ryan Scheuermann
> 
> ----
> Concept 64, Inc. | Phone: 610.349.0703 | Web: www.concept64.com
> 
> 
> 
> Viper007Bond wrote:
>> But hows does that differ from the documented way? i.e. how does that 
>> not make an item in the submenu row called "podPress"?
>>
>> - Viper
>>
>> Dan Kuykendall wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> I accomplished this in podpress without having to go back and remove
>>> some submenu
>>>
>>> Relevant code
>>>
>>> if (function_exists('add_menu_page')) {
>>>   add_menu_page(__('podPress'), __('podPress'), $permission_needed,
>>> 'podpress/podpress_feed.php');
>>> }
>>>
>>> if (function_exists('add_submenu_page')) {
>>>
>>>   add_submenu_page('podpress/podpress_feed.php', __('Feed/iTunes
>>> Settings'), __('Feed/iTunes Settings'), $permission_needed,
>>> 'podpress/podpress_feed.php');
>>>
>>>   add_submenu_page('podpress/podpress_feed.php', __('General Settings'),
>>> __('General Settings'), $permission_needed,
>>> 'podpress/podpress_general.php');
>>>
>>>   add_submenu_page('podpress/podpress_feed.php', __('Player Settings'),
>>> __('Player Settings'), $permission_needed, 
>>> 'podpress/podpress_players.php');
>>>   if($podPress->settings['enableStats'] == true) {
>>>
>>>     add_submenu_page('podpress/podpress_feed.php', __('Stats'),
>>> __('Stats'), $permission_needed, 'podpress/podpress_stats.php');
>>>   }
>>> }
>>>             }
>>>         }
>>>
>>>
>>> Viper007Bond wrote:
>>>> So I guess my previous e-mail didn't come through, but that's okay as I
>>>> figured it out anyway.
>>>>
>>>> When you make a new top-level menu (yes, I'm sure I really need one) 
>>>> and
>>>> then another page as a submenu under it, a submenu is also made with 
>>>> the
>>>> title of the top-level menu. I didn't want that.
>>>>
>>>> So, I thought I'd share the code I came up with:
>>>>
>>>> http://files.viper007bond.com/wordpress/menu_test.phps
>>>>
>>>> Enjoy and feel free to provide improvement suggestions. :)
>>>>
>>>> - Viper007Bond
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>> - --
>>> Dan Kuykendall (aka Seek3r)
>>> http://www.mightyseek.com
>>>
>>> In God we trust, all others we virus scan.
>>> Programmer - an organism that turns coffee into software.
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.3 (MingW32)
>>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>>
>>> iD8DBQFEbBN/K8FkGutbdPMRAsIFAJ0cKvmqBFwT7dqkQiz9eoXATz7S6QCgmNeH
>>> csAkatzv8kZH/cjp92T35FM=
>>> =gnVM
>>> -----END PGP SIGNATURE-----
>>> _______________________________________________
>>> 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
>>
>>
>>
> _______________________________________________
> 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