1

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

Screenshot

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

-1

As 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

  • Thanks for the answer but this doesn't seem to solve the problem. The thread you linked to is relevant to adding the custom post type menu item at the top level (i.e. on the same level as 'Posts'), rather than having it nested within an admin menu. I've tried changing the menu_position value to all sorts but nothing seems to affect the positioning. – Godge Jul 23 '14 at 12:06
  • Sorry, didn't read the question correct. – kuchenundkakao Jul 23 '14 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.