In wordpress you can create a admin page in admin section, to start this we have to first use hook function add_action() to create a menu in admin.
Before doing this we have to first create a directory under the plugins folder for now we create 'hello-world'
In hello-world dire create plugins.php file and start code there ,
First we need to provide plugins information
/*
Plugin Name: My admin page
Description: crate a admin page
Author: Prabhat jhaba
Version: 0.1
*/
now hook into admin menu using add_action() and write php code to create page in admin
add_action('admin_menu', 'setup_menu');
function setup_menu(){
add_menu_page( 'Plugin Page Title', 'Hello Admin Page', 'manage_options', 'hello-world', 'function_display' );
}
Using add_menu_page you we have create a new label in admin menu sidebar and register a function to output the page content and on that function we will simply print a message
function function_display(){
echo "Hello World !
";
}
You can also include php files in function_display() to write you code .
0 Comment(s)