PHP code example of abuyoyo / adminmenupage

1. Go to this page and download the library: Download abuyoyo/adminmenupage 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/ */

    

abuyoyo / adminmenupage example snippets


// Require the Composer autoloader anywhere in your code.

// Import AdminPage.
use WPHelper\AdminPage;

// Register the admin menu page.
$args = [
    'title' => 'The Tile of My Page', // title - passed to add_menu_page
    'menu_title' => 'Page Title', // menu_title - passed to add_menu_page (optional - will use title if none provided)
    'capability' => 'manage_options', // capability - passed to add_menu_page (optional - will default to 'manage_options')
    'slug' => 'my_page', // slug - passed to add_menu_page
    'template' => 'tpl/my_admin_page.php', // template - , true ]
    ];
];

// Register the admin menu page.
$admin_menu_page = new AdminPage( $args );

// That's it. We're done.
// This function can be called from anywhere. No need to wrap in any hook.