Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating Wordpress Admin Page

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 304
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: