How to define the menu-title for a custom post type?

I used register_post_type() to create custom post type.

My problem is that the title of my first sub-menu item is the name of the post type. How can I define a custom title for the menu item?

add_action( 'init', 'myofferlugin' );

function myofferlugin() {

    $labels = array( 
        'name' => _x( 'My Plugin', 'offer' ),
        'singular_name' => _x( 'Meno one', 'offer' ),
        'add_new' => _x( 'Add New', 'offer' ),
        'menu_name' => _x( 'My Plugin', 'offer' )
    );

    $args = array( 
        'labels' => $labels,
        'hierarchical' => false,
        'supports' => array( 'title' ),
        'menu_icon' => plugins_url('images',  __FILE__).'/icon.png',
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => true,
        'capability_type' => 'post'
    );

    register_post_type( 'offer', $args );
}

Related posts

Leave a Reply

1 comment