Ads 4 You

add_menu_page() with different name for first submenu item

Email Id : phpmk888@gmail.com

add_menu_page() with different name for first submenu item

When adding more pages later via add_submenu_page, the main page becomes the first entry in the submenu:



 
<?php 

add_action('admin_menu', 'event_setup_menu');

function event_setup_menu() {
    add_menu_page('Waiting List Page', 'Show Event Entries', 'manage_options', 'eventregistration-plugin', 'eventregistration_init');
    add_submenu_page('eventregistration-plugin', 'Waiting List Request', 'Waiting List Request', 'manage_options', 'waiting_list_request', 'waiting_list_request');
    add_submenu_page('eventregistration-plugin', 'Additional Attendees', 'Additional Attendees', 'manage_options', 'additional_attendees_list', 'additional_attendees_list');
    unset($GLOBALS['submenu']['eventregistration-plugin'][0]);
}

function additional_attendees_list() {
 
}

function waiting_list_request() {
 
}
?>
 
//make the slug of parent menu item and sub menu same (first one item) like below
<?php 

function acutions_recent_bids_add_admin_page(){

add_menu_page('Recent Bids', 'Auction Reports', 'manage_options','wc-auction-reports','acutions_recent_bids_list','dashicons-chart-area', 56);   

add_submenu_page(
    'wc-auction-reports',       // parent slug
    'Recent Bids',    // page title
    'Recent Bids',             // menu title
    'manage_options',           // capability
    'wc-auction-reports', // slug
    'acutions_customers_spendings_list' // callback
); 


add_submenu_page(
    'wc-auction-reports',       // parent slug
    'Customer Spending',    // page title
    'Customer Spending',             // menu title
    'manage_options',           // capability
    'wc-acutions-customers-spendings', // slug
    'acutions_customers_spendings_list' // callback
); 

add_submenu_page(
    'wc-auction-reports',       // parent slug
    'Customer Bids',    // page title
    'Customer Bids',             // menu title
    'manage_options',           // capability
    'wc-acutions-customers-bids', // slug
    'acutions_customers_bids_list' // callback
);  

}

add_action('admin_menu','acutions_recent_bids_add_admin_page'); 
?>

Comments

  1. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Hire Yii Framework Development Company in India

    ReplyDelete

Post a Comment