将wordpress仪表板中的主菜单移动为自定义帖子类型菜单的子项

时间:2015-11-15 20:52:49

标签: php wordpress

您好我有一个名为Lotto Syndicates的自定义帖子类型菜单,使用此代码:

function my_custom_post_lotto_syndicate() {


$labels = array(

    'name'               => _x( 'Lotto Syndicate', 'post type general name' ),

    'singular_name'      => _x( 'Lotto Syndicate', 'post type singular name' ),

    'add_new'            => _x( 'New Lotto Syndicate', 'Lotto Syndicate' ),

    'add_new_item'       => __( 'Add New Lotto Syndicate' ),

    'edit_item'          => __( 'Edit Lotto Syndicate' ),

    'new_item'           => __( 'New Lotto Syndicate' ),

    'all_items'          => __( 'All Lotto Syndicates' ),

    'view_item'          => __( 'View Lotto Syndicate' ),

    'search_items'       => __( 'Search Lotto Syndicate' ),

    'not_found'          => __( 'No Lotto Syndicate found' ),

    'not_found_in_trash' => __( 'No Lotto Syndicate found in the Trash' ), 

    'parent_item_colon'  => '',

    'menu_name'          => 'Lotto Syndicates'

);

$args = array(

    'labels'        => $labels,

    'description'   => 'Holds our Lotto Syndicate and Lotto Syndicate specific data',

    'public'        => true,

    'menu_position' => 5,

    'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),

    'has_archive'   => true,

);

register_post_type( 'Lotto Syndicate', $args ); 


}


add_action( 'init', 'my_custom_post_lotto_syndicate' );

我还将主用户菜单重命名为' Syndicate Users'我想将它(以及它的子项)移动到我的自定义帖子类型中,这是我用来重命名用户菜单的代码:

function change_post_menu_label() {

global $menu;

global $submenu;

$menu[70][0] = 'Syndicate Users';

$submenu['user-new.php'][5][0] = 'Syndicate User';

$submenu['user-new.php'][10][0] = 'Add Syndicate User';

$submenu['users.php'][5][0] = 'All Syndicate Users';

$submenu['users.php'][10][0] = 'Add Syndicate User';

}

add_action( 'admin_menu', 'change_post_menu_label' );

我查看了wordpress开发文档但我无法找到如何将主项目菜单移动到自定义帖子类型菜单中,我已经找到了如何将自定义帖子类型菜单移动到主菜单中但是& #39;不是我想要的。

0 个答案:

没有答案