Skip to content

Instantly share code, notes, and snippets.

@danielpataki
Last active December 16, 2018 07:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save danielpataki/762dd3e44db22f5d53b7 to your computer and use it in GitHub Desktop.
Save danielpataki/762dd3e44db22f5d53b7 to your computer and use it in GitHub Desktop.
Admin Pages
function myplguin_admin_page(){
?>
<div class="wrap">
<h2>Welcome To My Plugin</h2>
</div>
<?php
}
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'myplugin/myplugin-admin-page.php', 'myplguin_admin_page', 'dashicons-tickets', 6 );
add_submenu_page( 'myplugin/myplugin-admin-page.php', 'My Sub Level Menu Example', 'Sub Level Menu', 'manage_options', 'myplugin/myplugin-admin-sub-page.php', 'myplguin_admin_sub_page' );
}
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
add_menu_page( 'My Top Level Menu Example', 'Top Level Menu', 'manage_options', 'myplugin/myplugin-admin-page.php', 'myplguin_admin_page', 'dashicons-tickets', 6 );
}
@AshboDev
Copy link

Just FYI, in sub-level.php there's a typo at the end of line 4: myplguin_admin_page should be myplugin_admin_page.

@danielpataki

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment