admin管理员组文章数量:1122846
I'm writing a plugin (for the first time, so bear with me!) which includes a custom post type; 'Programmes'. In the admin menu, I've set up a new menu group for the plugin, and I have the 'Programmes' menu item within that, along with some others. My problem is that the 'Programmes' item only seems to appear first, when I have an item called 'Dashboard' which I want to appear first. I've tried altering the 'menu_position' argument but that hasn't made a difference (presumably this only applies to the top-level admin menu).
This is how my menu is rendering:
- Hiblio
- Programmes
- Dashboard
- Applications
Whereas this is how I'd like it to look:
- Hiblio
- Dashboard
- Programmes
- Applications
Here's my arguments for the custom post type:
$args = array(
'label' => __( 'programmes', 'hiblio' ),
'description' => __( 'Programmes for application from partner organisations', 'hiblio' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'programmes_categories' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => 'hiblio',
'show_in_nav_menus' => false,
'show_in_admin_bar' => false,
'menu_position' => 2,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'post'
);
Any ideas?
Thanks in advance,
Ash
I'm writing a plugin (for the first time, so bear with me!) which includes a custom post type; 'Programmes'. In the admin menu, I've set up a new menu group for the plugin, and I have the 'Programmes' menu item within that, along with some others. My problem is that the 'Programmes' item only seems to appear first, when I have an item called 'Dashboard' which I want to appear first. I've tried altering the 'menu_position' argument but that hasn't made a difference (presumably this only applies to the top-level admin menu).
This is how my menu is rendering:
- Hiblio
- Programmes
- Dashboard
- Applications
Whereas this is how I'd like it to look:
- Hiblio
- Dashboard
- Programmes
- Applications
Here's my arguments for the custom post type:
$args = array(
'label' => __( 'programmes', 'hiblio' ),
'description' => __( 'Programmes for application from partner organisations', 'hiblio' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'programmes_categories' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => 'hiblio',
'show_in_nav_menus' => false,
'show_in_admin_bar' => false,
'menu_position' => 2,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'post'
);
Any ideas?
Thanks in advance,
Ash
Share Improve this question edited May 31, 2019 at 12:51 Glorfindel 6093 gold badges10 silver badges18 bronze badges asked Jul 23, 2014 at 10:57 AJTAJT 1871 silver badge11 bronze badges1 Answer
Reset to default 0As the dashboard uses the menu_position 2, just use menu_position 1.
so:
$args = array(
'label' => __( 'programmes', 'hiblio' ),
'description' => __( 'Programmes for application from partner organisations', 'hiblio' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'taxonomies' => array( 'programmes_categories' ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => 'hiblio',
'show_in_nav_menus' => false,
'show_in_admin_bar' => false,
'menu_position' => 1,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'capability_type' => 'post'
);
Information by: Placing a custom post type menu above the Posts menu using menu_position?
Happy Coding,
Kuchenundkakao
本文标签: How do I alter the position of a Custom Post Type menu item within my plugin admin menu
版权声明:本文标题:How do I alter the position of a Custom Post Type menu item within my plugin admin menu? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736293249a1929106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论