Skip to main content
added 28 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true (for main) or "edit.php?post_type=party (for subentries)
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

I also know that I can work around with

add_submenu_page(
     "edit.php?post_type=party"
    ,"Add New"
    ,"Add New"
    ,"post-new.php?post_type=party"
);

but I'm not interested in the work around. I want to know how this is thought to work out of the box.

1) CPT = short for custom post type

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true or "edit.php?post_type=party
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

I also know that I can work around with

add_submenu_page(
     "edit.php?post_type=party"
    ,"Add New"
    ,"Add New"
    ,"post-new.php?post_type=party"
);

but I'm not interested in the work around. I want to know how this is thought to work out of the box.

1) CPT = short for custom post type

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true (for main) or "edit.php?post_type=party (for subentries)
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

I also know that I can work around with

add_submenu_page(
     "edit.php?post_type=party"
    ,"Add New"
    ,"Add New"
    ,"post-new.php?post_type=party"
);

but I'm not interested in the work around. I want to know how this is thought to work out of the box.

1) CPT = short for custom post type

Tweeted twitter.com/#!/StackWordPress/status/137128282285019136
added 300 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true or "edit.php?post_type=party
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

I also know that I can work around with

add_submenu_page(
     "edit.php?post_type=party"
    ,"Add New"
    ,"Add New"
    ,"post-new.php?post_type=party"
);

but I'm not interested in the work around. I want to know how this is thought to work out of the box.

1) CPT = short for custom post type

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true or "edit.php?post_type=party
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

1) CPT = short for custom post type

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true or "edit.php?post_type=party
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

I also know that I can work around with

add_submenu_page(
     "edit.php?post_type=party"
    ,"Add New"
    ,"Add New"
    ,"post-new.php?post_type=party"
);

but I'm not interested in the work around. I want to know how this is thought to work out of the box.

1) CPT = short for custom post type

Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244

register multiple post types on one menu entry

Case:

I register_post_type() 3 different CPTs1)

Example: 3 post types named party, event, location. The other needed arguments in the array are left out.

register_post_type(
     'party'
    ,array( 
        'show_in_menu' // true or "edit.php?post_type=party
     )
);
  • Then I set the 'show_in_menu' argument for the first CPT item (a.k.a "party") to true
  • The other items get set 'show_in_menu' to 'edit.php?post_type=party

Result:

enter image description here

What's the point with this? What I expected was that I get "Add New" menu items for all of them, not only for the main CPT.

How would I do set the arguments to not only get list views, but single new/edit screens as well?

Notes:

I know, that I got an Add New button in the list view on top next to the title, but I want to know how I could add these links to the admin menu items.

1) CPT = short for custom post type