2012-08-10 56 views
0

我正在開發一個插件。這是源代碼:創建一個WordPress的子菜單沒有管理菜單鏈接

add_action('admin_menu', 'hotel_bid_hook'); 
function hotel_bid_hook() 
{ 
    add_submenu_page("edit.php?post_type=oteller","Hotel Bids", "Hotel Bids", "manage_options", "hotel-bids", "hotel_bid_page"); 
} 
function hotel_bid_page() { 
     // Displays a list of bids for hotels and an EDIT button for every bid 
} 

如您所見,有一個酒店出價頁面列出了所有出價。我也想創建一個頁面。此頁面有一個用於編輯出價的HTML表單。我對矯正我的源代碼是這樣的:

add_action('admin_menu', 'hotel_bid_hook'); 
function hotel_bid_hook() 
{ 
    add_submenu_page("edit.php?post_type=oteller","Hotel Bids", "Hotel Bids", "manage_options", "hotel-bids", "hotel_bid_page"); 
    add_submenu_page("edit.php?post_type=oteller","Edit Hotel Bids", "Edit Hotel Bids", "manage_options", "edit-hotel-bid", "edit_hotel_bid"); 
} 
function hotel_bid_page() { 
     // Displays a list of bids for hotels and an EDIT button for every bid 
     // Edit buttons will be like this : <a href="?page=edit-hotel-bid&hotelID=1"> 
} 
function edit_hotel_bid() 
{ 
    // HTML Web form 
} 

但是這一次,還有下oteller自定義後類型編輯酒店投標鏈接。

enter image description here

不應該有一個編輯酒店投標此處鏈接。此頁面將只顯示用戶單擊編輯按鈕。我應該使用哪個功能而不是add_submenu_page()

回答