我不确定这个术语,因为谷歌搜索并没有真正把我带向正确的方向。
我目前有一个WordPress插件,它位于设置选项卡内。
我想有我自己的标签,下面有3个子部分。
我试过看这些:
add_action(\'admin_menu\', \'jobboard_admin_actions\');
function jobboard_admin_actions() {
add_options_page(\'JobBoard\', \'JobBoard\', \'manage_options\', __FILE__, \'JobBoard_admin\');
}
但我还是被卡住了。
谢谢
更改:
add_action(\'admin_menu\', \'jobboard_admin_actions\');
function jobboard_admin_actions() {
add_menu_page(\'JobBoard\', \'JobBoard\', \'manage_options\', JobBoard_admin, \'JobBoard_admin\', \'\');
add_submenu_page( \'JobBoard_admin\', \'JobBoard\', \'JobBoard\', \'manage_options\', \'JobBoard_admin\', \'JobBoard_admin_delete\' );
}
最合适的回答,由SO网友:Marin Bînzari 整理而成
以下是我用过的东西:
add_action( \'admin_menu\', \'manage_poll_menu\' );
function manage_poll_menu() {
add_menu_page( \'Manage Polls\', \'Polls\', \'manage_polls_cap\', \'manage_polls\', \'my_poll_options\', \'\' );
add_submenu_page( \'manage_polls\', \'Add New\', \'Add New Poll\', \'manage_polls_cap\', \'add_new_poll\', \'my_poll_options\' );
add_submenu_page( \'manage_polls\', \'Poll Sections\', \'Poll Sections\', \'manage_polls_cap\', \'poll_sections\', \'my_poll_options\' );
add_submenu_page( \'manage_polls\', \'Add New Poll Section\', \'Add New Poll Section\', \'manage_polls_cap\', \'add_new_poll_section\', \'my_poll_options\' );
}
function my_poll_options() {
if ( !current_user_can( \'manage_polls_cap\' ) ) {
wp_die( __( \'You do not have sufficient permissions to access this page.\' ) );
}
echo \'<div class="wrap">Page content</div>\';
}
还有关于
Administration Menus 和
Submenu Pages 您可以在上找到
here.