2012-08-10 60 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()

回答