Changes between Initial Version and Version 1 of Ticket #26935
- Timestamp:
- 03/21/2014 12:35:20 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #26935
-
Property
Version
changed from
trunk
to3.8
-
Property
Version
changed from
-
Ticket #26935 – Description
initial v1 2 2 3 3 If we have "Main" as our main page, and "Sub" as our sub page... 4 5 6 7 4 {{{ 5 add_menu_page('Main', 'Main', 'manage_options', 'main_options', array($this, 'main_do_page')); 6 add_submenu_page('main_options', 'Sub', 'Sub', 'manage_options', 'sub_options', null); 7 }}} 8 8 This will create a menu structure such as: 9 9 * Main … … 14 14 15 15 Now, we can hide that duplication with a slight adjustment to the code: 16 17 18 19 16 {{{ 17 add_menu_page('Main', 'Main', 'manage_options', 'main_options', array($this, 'main_do_page')); 18 add_submenu_page('main_options', 'Sub', 'Sub', 'manage_options', 'main_options', null); 19 }}} 20 20 By changing the fifth argument to match the "Main" page slug.. it will successfully hide the submenu; resulting in: 21 21 … … 26 26 27 27 It appears in the submenu html output as such (with the second snippet above): 28 29 28 {{{ 29 <li class="wp-first-item current"> 30 30 <a class="wp-first-item current" href="admin.php?page=main_options"></a> 31 32 31 </li> 32 <li> 33 33 <a href="admin.php?page=sub_options">Options</a> 34 35 34 </li> 35 }}} 36 36 See how the top item has the html for a list item.. but has no inner html? 37 37