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 );
}
I am not 100% sure if this is what you mean, but to edit the submenu label for custom post types the label to edit is “all_items”. For example:
Would give you a main navigation label of “Books” and the sub menu items would be “All Books” and “Add New”.
See https://codex.wordpress.org/Function_Reference/register_post_type for the full list of labels