Adding the custom page with add_menu_page function on Wordpress



PHP Snippet 1:

function my_admin_menu() {
    add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'example.php', 'myplguin_admin_page', 'dashicons-tickets', 6  );
}

function myplguin_admin_page(){
    echo 'Welcome to admin page';
}

PHP Snippet 2:

add_menu_page(
    'Import Resi', // Page Title
    'Import Resi', // Menu Title
    'manage_options', // Capabiliy
    'import_php/index.php', // Menu_slug
    '', // function
    '', // icon_url
    6   // position
);
add_menu_page(
    'Admin Cek', // Page Title
    'Admin Cek', // Menu Title
    'manage_options', // Capabiliy
    'admin_cek/index.php', // Menu_slug
    '', // function
    '', // icon_url
    7   // position
);

PHP Snippet 3:

function my_admin_menu() {
   add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'example', 'display_text', 'need a uri to your image here!!', 6  );
}


function display_text(){
    require_once 'pathtofile.php'; //--> make sure you read up on paths and require to find your file.
}