我想在我的web应用程序中使用自定义帖子类型,并想在插件菜单中使用该url。我已经创建了这样的自定义帖子类型。
register_post_type( \'reserve\',
array(
\'labels\' => array(
\'name\' => __( \'Reserves\' ),
\'singular_name\' => __( \'Reserve\' ),
\'all_items\' => __( \'All Reserves\' ),
\'add_new\' => __( \'Add Reserve\' ),
\'add_new_item\' => __( \'Add New Reserve\' ),
\'edit\' => __( \'Edit\'),
\'edit_item\' => __( \'Edit Reserve\' ),
\'new_item\' => __( \'New Reserve\'),
\'view\' => __( \'View Reserve\'),
\'view_item\' => __( \'View Reserve\'),
\'search_items\' => __( \'Search Reserves\'),
\'not_found\' => __( \'No Reserves found\' ),
\'not_found_in_trash\' => __( \'No Reserves found in trash\' ),
\'parent\' => __( \'Parent Reserve\')
),
\'description\' => __( \'This is where you can add new Reserves\' ),
\'public\' => true,
\'show_ui\' => false,
\'capability_type\' => \'page\',
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'hierarchical\' => true,
\'rewrite\' => array( \'slug\' => \'reserves\', \'with_front\' => false ),
\'query_var\' => true,
\'supports\' => array( \'title\', \'editor\', \'thumbnail\', \'comments\', \'excerpt\',/*, \'page-attributes\'*/ ),
\'has_archive\' => true,
\'show_in_nav_menus\' => true
)
);
请注意,我已将show\\u ui设置为false,以便我的新自定义类型不会显示在管理侧栏上。现在,我正在创建一个我的插件菜单,如下所示。
$topslug = \'reserve/admin\';
add_menu_page(\'Reserve Overview\', \'Reservation\', \'view_reservation_plugin\', $topslug, \'show_start_page\',RESERVE_URL.\'images/menu_icon.png\');
add_submenu_page($topslug, \'RESERVE\', \'Reserve Builder\', \'view_reservation_plugin\', \'reserve/manage_reserve\', \'show_manage_reserves\');
从上面的代码中,您可以发现我创建了一个菜单作为Reserve,它有两个子菜单1)Reserve Overview 2)Reserve Builder。
现在我的问题是我想更改我的保留生成器的URL。
目前是其管理员。php?第页=保留/管理\\u保留”。我想将其更改为“编辑”。php?post\\u type=reserve\'以便我可以使用wordpress内置工具。
说我是否通过了“编辑”。php?添加子菜单页面中的“post\\u type=reserve”(“edit.php?post\\u type=reserve”,“reserve”,“reserve Builder”,“view\\u reserve\\u插件”,“reserve/manage\\u reserve”,“show\\u manage\\u reserves”)。菜单消失。TIA。