0

我正在开发一个插件。这是源代码:

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 custom post type下有一个Edit Hotel Bids链接。

在此处输入图像描述

此处不应有“编辑酒店出价”链接。此页面将仅显示用户单击编辑按钮。我应该使用哪个功能而不是add_submenu_page()

4

1 回答 1

0

在这个问题上找到答案:https ://wordpress.stackexchange.com/questions/1778/admin-config-screen-without-menu/1812#1812

于 2012-08-10T22:11:06.777 回答