Help with add_menu_page and add_submenu_page
-
Hi there.
How do I create my add_menu_page and add_submenu_page’s if there’s functions are located in a different file? I have tried to replace __FILE__ with path to the files, like this ‘myplugindir/myadminpage.php’, but I can’t get it to work.
I have really struggled with this so I hope someone has the answer.
Thanks
-
You need to enter the file name of the core WordPress file you want to add, for examples (for v2.6):
<dl>
<dt>Under ‘Write'</dl>
<dd>add_submenu_page(‘post-new.php’,…)</dd>
<dt>Under ‘Manage'</dl>
<dd>add_submenu_page(‘edit.php’,…)</dd>
<dt>Under ‘Design'</dl>
<dd>add_submenu_page(‘themes.php’,…)</dd>
<dt>Under ‘Comments'</dl>
<dd>add_submenu_page(‘edit-comments.php’,…)</dd>
<dt>Under ‘Settings'</dl>
<dd>add_submenu_page(‘options-general.php’,…)</dd>
<dt>Under ‘Plugins'</dl>
<dd>add_submenu_page(‘plugins.php’,…)</dd>
<dt>Under ‘Users'</dl>
<dd>add_submenu_page(‘users.php’,…)</dd>
</dl>
Note that I didn’t show all the parameters for the add_submenu_page() for those who struggle with PHP programming; the ‘…’ are just placeholders. To learn about the full list of parameters go to http://codex.wordpress.org/Adding_Administration_Menus#Sub-Menus.Opps, WordPress.org didn’t like my use of a description list. Here is a better formatted version of my list:
- <b>For ‘Write'</b> &mdash add_submenu_page(‘post-new.php’,…)
- <b>For ‘Manage'</b> &mdash add_submenu_page(‘edit.php’,…)
- <b>For ‘Design'</b> &mdash add_submenu_page(‘themes.php’,…)
- <b>For ‘Comments'</b> &mdash add_submenu_page(‘edit-comments.php’,…)
- <b>For ‘Settings'</b> &mdash add_submenu_page(‘options-general.php’,…)
- <b>For ‘Plugins'</b> &mdash add_submenu_page(‘plugins.php’,…)
- <b>For ‘Users'</b> &mdash add_submenu_page(‘users.php’,…)
Sigh. Once again:
- For ‘Write’: add_submenu_page(‘post-new.php’,…)
- For ‘Manage’: add_submenu_page(‘edit.php’,…)
- For ‘Design’: add_submenu_page(‘themes.php’,…)
- For ‘Comments’: add_submenu_page(‘edit-comments.php’,…)
- For ‘Settings’: add_submenu_page(‘options-general.php’,…)
- For ‘Plugins’: add_submenu_page(‘plugins.php’,…)
- For ‘Users’: add_submenu_page(‘users.php’,…)
🙂 finally good one.
Thanks
- The topic ‘Help with add_menu_page and add_submenu_page’ is closed to new replies.