• ozmodiar

    (@ozmodiar)


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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:

    1. <b>For ‘Write'</b> &mdash add_submenu_page(‘post-new.php’,…)
    2. <b>For ‘Manage'</b> &mdash add_submenu_page(‘edit.php’,…)
    3. <b>For ‘Design'</b> &mdash add_submenu_page(‘themes.php’,…)
    4. <b>For ‘Comments'</b> &mdash add_submenu_page(‘edit-comments.php’,…)
    5. <b>For ‘Settings'</b> &mdash add_submenu_page(‘options-general.php’,…)
    6. <b>For ‘Plugins'</b> &mdash add_submenu_page(‘plugins.php’,…)
    7. <b>For ‘Users'</b> &mdash add_submenu_page(‘users.php’,…)

    Sigh. Once again:

    1. For ‘Write’: add_submenu_page(‘post-new.php’,…)
    2. For ‘Manage’: add_submenu_page(‘edit.php’,…)
    3. For ‘Design’: add_submenu_page(‘themes.php’,…)
    4. For ‘Comments’: add_submenu_page(‘edit-comments.php’,…)
    5. For ‘Settings’: add_submenu_page(‘options-general.php’,…)
    6. For ‘Plugins’: add_submenu_page(‘plugins.php’,…)
    7. For ‘Users’: add_submenu_page(‘users.php’,…)
    taghaboy

    (@taghaboy)

    🙂 finally good one.
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help with add_menu_page and add_submenu_page’ is closed to new replies.