The code adds a new parent menu item called “Auction Reports” in the WordPress admin dashboard. Each submenu links to a custom page in the admin dashboard where site owners can add relevant content or functionality.
// Function to add the custom plugin menu function ts_actions_recent_bids_add_admin_page() { // Parent Menu: Auction Reports add_menu_page( 'Auction Reports Page', // Page title 'Auction Reports', // Menu title 'manage_options', // Capability 'wc-auction-reports', // Menu slug 'ts_auction_reports_page', // Parent menu callback function 'dashicons-chart-area', // Icon 56 // Position ); // Submenu: Recent Bids add_submenu_page( 'wc-auction-reports', // Parent slug 'Recent Bids Page', // Page title 'Recent Bids', // Submenu title 'manage_options', // Capability 'wc-auction-reports', // Submenu slug (same as parent) 'ts_actions_recent_bids_list' // Callback function ); // Submenu: Customer Spending add_submenu_page( 'wc-auction-reports', 'Customer Spending Page', 'Customer Spending', 'manage_options', 'wc-acutions-customers-spendings', 'ts_acutions_customers_spendings_list' ); // Submenu: Customer Bids add_submenu_page( 'wc-auction-reports', 'Customer Bids Page', 'Customer Bids', 'manage_options', 'wc-acutions-customers-bids', 'ts_acutions_customers_bids_list' ); } add_action('admin_menu', 'ts_actions_recent_bids_add_admin_page'); // Parent menu callback function function ts_auction_reports_page() { echo '<h1>Auction Reports</h1>'; echo '<p>Welcome to the Auction Reports overview page.</p>'; } // Submenu callback functions function ts_actions_recent_bids_list() { echo '<h1>Recent Bids</h1>'; echo '<p>Content for Recent Bids page.</p>'; } function ts_acutions_customers_spendings_list() { echo '<h1>Customer Spending</h1>'; echo '<p>Content for Customer Spending page.</p>'; } function ts_acutions_customers_bids_list() { echo '<h1>Customer Bids</h1>'; echo '<p>Content for Customer Bids page.</p>'; }