Wordpress页面菜单选项

时间:2014-12-29 09:35:33

标签: wordpress

您好我需要此代码中的帮助

`add_action( 'admin_menu', 'register_my_custom_menu_page' );

function register_my_custom_menu_page(){     add_menu_page('自定义菜单标题','自定义菜单',' my-menu-slug2'' manage_options',' custompage& #39;,' my_custom_menu_page',plugins_url(' myplugin / images / icon.png'

), 8 );
//add_submenu_page("my-menu-slug2", "My Submenu", "My Submenu", 0, "my-submenu-slug", "mySubmenuPageFunction");
 //add_submenu_page("my-menu-slug2", "My Submenu2", "My Submenu2", 0, "my-submenu-slug", "mySubmenuPageFunction"); 

}`

function my_custom_menu_page(){ echo "Admin Page Test"; }

当我添加" my-menu-slug2"在add-menu-page中,菜单将消失,我想添加子页面。在子菜单中,在子菜单名称"我的子菜单2"之后,参数为0。如果在主菜单中添加它然后它会出现但位置不起作用它将出现在底部 任何人都可以请帮助

1 个答案:

答案 0 :(得分:0)

试试这个:

add_menu_page('My Custom Page', 'My Custom Page', 'manage_options', 'my-top-level-slug');

add_submenu_page( 'my-top-level-slug', 'My Custom Page', 'My Custom Page', 'manage_options', 'my-top-level-slug', 'mySubmenuPageFunction');

add_submenu_page( 'my-top-level-slug', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-secondary-slug', 'mySubmenuPageFunction');

参考:http://codex.wordpress.org/Function_Reference/add_submenu_page