我也在寻找同样的东西,我想我会复制Mike提供的代码,他声称下面的代码仍然是alpha,因为只有他在使用它。
我已经测试过了,它似乎对我很有效。我确信有一些用例他们还没有处理。
也许Mike会在这里发表评论,并提供额外的帮助,帮助您如何利用他的课程来实现您的目标。
您可以下载该文件,将其放在主题的目录中:https://gist.github.com/792b7aa5b695d1092520
下面的内容显示了如何调用主题函数中的函数。php文件:
<?php
require_once(\'wp-admin-menu-classes.php\');
add_action(\'admin_menu\',\'my_admin_menu\');
function my_admin_menu() {
swap_admin_menu_sections(\'Pages\',\'Posts\'); // Swap location of Posts Section with Pages Section
rename_admin_menu_section(\'Media\',\'Photos & Video\'); // Rename Media Section to "Photos & Video"
delete_admin_menu_section(\'Links\'); // Get rid of Links Section
$movie_tags_item_array = get_admin_menu_item_array(\'Movies\',\'Movie Tags\'); // Save off the Movie Tags Menu
update_admin_menu_section(\'Movies\',array( // Rename two Movie Menu Items and Delete the Movie Tags Item
array(\'rename-item\',\'item\'=>\'Movies\',\'new_title\'=>\'List Movies\'),
array(\'rename-item\',\'item\'=>\'Add New\',\'new_title\'=>\'Add Movie\'),
array(\'delete-item\',\'item\'=>\'Movie Tags\'),
));
copy_admin_menu_item(\'Movies\',array(\'Actors\',\'Add New\')); // Copy the \'Add New\' over from Actors
renamed_admin_menu_item(\'Movies\',\'Add New\',\'Add Actor\'); // Rename copied Actor \'Add New\' to \'Add Actor
add_admin_menu_item(\'Movies\',array( // (Another way to get a \'Add Actor\' Link to a section.)
\'title\' => \'Alt Add Actor \',
\'slug\' => \'post-new.php?post_type=actor\',
), array(// Add Back the Movie Tags at the end.
\'where\'=>\'end\'
));
add_admin_menu_item(\'Movies\',$movie_tags_item_array,array(// Add Back the Movie Tags at the end.
\'where\'=>\'end\'
));
delete_admin_menu_section(\'Actors\'); // Finally just get rid of the actors section
}
更重要的是,这些函数甚至正在考虑(作为基础)包含在WordPress 3.1中,所以如果我们幸运的话,这些函数甚至可能成为标准!