How to Create and Install Plugin using WordPress

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.
  1. add_action('admin_menu''add_menu_option_function');  
  2. function add_menu_option_function()  
  3. {  
  4.    add_menu_page( __( 'main menu''myplugin' ), __( 'name of menu ''myplugin' ), 'admin_dashboard''myplugin''function_demo1' );  
  5.    add_submenu_page('mypluginr''submenu demo 1', __( 'submenu demo 1''myplugin' ), 'administrator''demo1''function_demo2');  
  6.    add_submenu_page('myplugin''submenu demo 2', __( 'submenu demo 2''myplugin' ), 'administrator''demo2''function_demo3');  
  7.    add_submenu_page('myplugin''submenu demo 3', __( 'submenu demo 2''myplugin' ), 'administrator''demo3''function_demo4');  
  8. }  
  9. function function_demo2()  
  10. {  
  11.    echo "this first function call";  
  12. }  
  13. function function_demo3()  
  14. {  
  15.    echo "this first function call";  
  16. }  
  17. function function_demo4(){  
  18.    echo "this first function call";  
  19. }  
Step 3: Go to Installed Plugins on the left side bar in wordpress and search your plugin and active.
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now