mardi 5 janvier 2016

WordPress Admin Menu & Plugin page Missing

I have created a plugin and have done so many times but for some reason I can not seem to get a navigation to the plugin settings page on the admin menu.

The following code I have used is:

// create custom plugin settings menu
add_action('admin_menu', 'uubba_categories_addmenus');

function uubba_categories_addmenus() {

    //create new top-level menu
    add_menu_page('Check My Stats', 'CMS Page', 'manage_options', 'uubbacmspage', 'uubba_cms_players_page', '', 6); 

}

I have also created a settings page but for some reason that is not echo'ing anything what so ever either. The code is as follows:

function uubba_cms_players_page(){

    global $wpdb;

    //get the players information needed
    $getinfo = $wpdb->get_results("SELECT username FROM uubba_userstats");

    $output = '<style>';
    $output .= '.uubbahr{margin:25px 0px;}';
    $output .= '.uubba-button-green,.uubba-button-green:visited{padding:8px 14px;background-color:#8FE485;color:white;}';
    $output .= '.uubba-button-green:hover{background-color:#79DC6E;color:white;}';
    $output .= '.uubba-button-red,.uubba-button-red:visited{padding:8px 14px;background-color:#F56A6A;color:white;}';
    $output .= '.uubba-button-red:hover{background-color:#E34747;color:white;}';
    $output .= '<style>';

    $output .= '<div class="wrap">';
    $output .= '<h1>Check My Stats Players</h1>';
    $output .= '<hr class="uubbahr">';
    $output .= '<table>';
    $output .= '<tr>';
    $output .= '<th scope="col"><h5 class="font12">Users Name</h5></th>';
    $output .= '<th scope="col"><h5 class="font12">Actions</h5></th>';
    $output .= '</tr>';

    foreach($getinfo as $gi){

        $output .= '<tr>';
        $output .= '<td><h3>'.$gi->username.'</h3></td>';
        $output .= '<td><a href="#" class="uubba-button-green">View Statistics</a> <a href="#" class="uubba-button-red">Delete User</a></td>';
        $output .= '</tr>';

    }

    $output .= '</table>';
    $output .= '</div>';

    echo $output;

}

I have no idea why this would not work, I have used this method a lot in the past and for some reason it just does not work on this plugin.

If anyone could shed some light on it, I would be most appreciated indeed :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire