我正在开发一个插件。这是源代码:
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 自定义帖子类型下有编辑酒店出价链接。
此处不应该有编辑酒店出价链接。此页面仅显示用户点击编辑按钮。我应该使用哪种功能而不是add_submenu_page()
?
答案 0 :(得分:0)