Home / admin / Create custom admin panel with add_menu_page
  • How to Create custom admin panel with add_menu_page

    create-custom-admin-panel-with-add_menu_page

    Adding a top level admin menu to your wordpress admin is simple just add this snippet to the functions.php of your wordpress theme. The new menu item will appear within the admin menu linking to the custom admin panel you define.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    add_action('admin_menu', 'create_custom_panel');
    function create_custom_panel() {
        add_menu_page('Custom panel', 'Custom panel', 'manage_options', 'custom-panel', 'custom_panel');
    }
    function custom_panel(){
    		echo '<div class="wrap"><div id="icon-options-general" class="icon32">
    			<br>
    		</div>
    		<h2>Custom panel</h2></div>';
    }
    

    ( WordPress codex functions, hooks, in this snippet. )

    admin_menu, add_action, add_menu_page,
  • N3sted

    How can I customize this page to edit  ” ?page=custom-panel ” ?

  • N3sted

    How can I customize this page to edit  ” ?page=custom-panel ” ?

  • N3sted

    Thank you I found the solution

  • N3sted

    Thank you I found the solution

  • N3sted

    For example Can I include post.php on this page? How is that done?

    • Can you elaborate ?

      • N3sted

        Hello
        I don’t understand what you say !!!For example, how can I execute commands post.php on this page?

        • Hi N3sted I need more detail before I can help, commands post.php i’m not sure what you mean.

        • N3sted

          thanks for the follow-up response
          in this panel,how can I call the command post or other command ?

  • how could you add a few custom posts into this menu?