Step 1: To create file php copy and paste comment code on the top of your plugin file.
/*
Plugin Name: MY First Plugin
Plugin URI: your url
Description: your Description
Version: 1.0
Author: Your name
Author URI: http://demo.com
License: demo2
*/
Step 2: When you paste code on top of page in your plugin file then copy the below code and paste code. this below will show menu on left side in wordpress.
- add_action('admin_menu', 'add_menu_option_function');
- function add_menu_option_function()
- {
- add_menu_page( __( 'main menu', 'myplugin' ), __( 'name of menu ', 'myplugin' ), 'admin_dashboard', 'myplugin', 'function_demo1' );
- add_submenu_page('mypluginr', 'submenu demo 1', __( 'submenu demo 1', 'myplugin' ), 'administrator', 'demo1', 'function_demo2');
- add_submenu_page('myplugin', 'submenu demo 2', __( 'submenu demo 2', 'myplugin' ), 'administrator', 'demo2', 'function_demo3');
- add_submenu_page('myplugin', 'submenu demo 3', __( 'submenu demo 2', 'myplugin' ), 'administrator', 'demo3', 'function_demo4');
- }
- function function_demo2()
- {
- echo "this first function call";
- }
- function function_demo3()
- {
- echo "this first function call";
- }
- function function_demo4(){
- echo "this first function call";
- }
Step 3: Go to Installed Plugins on the left side bar in wordpress and search your plugin and active.