PHP code example of devuri / wp-admin-page

1. Go to this page and download the library: Download devuri/wp-admin-page library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

devuri / wp-admin-page example snippets


  // You can install via Composer.
  uire_once plugin_dir_path( __FILE__ ). 'src/Admin/MyPluginAdmin.php';
  

use WPAdminPage\AdminPage;

final class MyPluginAdmin extends AdminPage {
  /**
   * admin_menu()
   *
   * Main top level admin menus
   * @return [type] [description]
   */
  private static function admin_menu(){
    $menu = array();
    $menu[] = 'My Plugin Menu Settings';
    $menu[] = 'My Plugin';
    $menu[] = 'manage_options';
    $menu[] = 'my-plugin';
    $menu[] = 'myplugin_callback';
    $menu[] = 'dashicons-admin-generic';
    $menu[] = null;
    $menu[] = 'myp';
    $menu[] = plugin_dir_path( __FILE__ );
    return $menu;
  }

	/**
	 * submenu()
	 * array of submenu items
	 * @return [type] [description]
	 */
	private static function submenu(){
		$submenu = array();
		$submenu[] = 'Menu One';
		$submenu[] = 'Menu Two';
		$submenu[] = 'etc';
		return $submenu;
	}

  /**
   * init
   * @return [type] [description]
   */
  public static function init(){
    return new MyPluginAdmin(self::admin_menu(),self::submenu());
  }
}

  // create admin pages
  MyPluginAdmin::init();