Make favorite actions custom post type aware. Props ptahdunbar. fixes #12433
git-svn-id: https://develop.svn.wordpress.org/trunk@13536 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8ef5d73550
commit
04899b5212
|
@ -3353,20 +3353,27 @@ function the_post_password() {
|
|||
* @since unknown
|
||||
*/
|
||||
function favorite_actions( $screen = null ) {
|
||||
global $post_type_object;
|
||||
|
||||
$default_action = false;
|
||||
|
||||
if ( is_string($screen) )
|
||||
$screen = convert_to_screen($screen);
|
||||
|
||||
if ( isset($post_type_object) ) {
|
||||
switch ( $screen->id ) {
|
||||
case 'post':
|
||||
$default_action = array('edit.php' => array(__('Edit Posts'), 'edit_posts'));
|
||||
case $post_type_object->name:
|
||||
$default_action = array('edit.php?post_type=' . $post_type_object->name => array(sprintf(__('Edit %s'), $post_type_object->label), $post_type_object->edit_type_cap));
|
||||
break;
|
||||
case 'edit-page':
|
||||
$default_action = array('post-new.php?post_type=page' => array(__('New Page'), 'edit_pages'));
|
||||
case "edit-{$post_type_object->name}":
|
||||
$default_action = array('post-new.php?post_type=' . $post_type_object->name => array(sprintf(__('New %s'), $post_type_object->singular_label), $post_type_object->edit_type_cap));
|
||||
break;
|
||||
case 'page':
|
||||
$default_action = array('edit.php?post_type=page' => array(__('Edit Pages'), 'edit_pages'));
|
||||
break;
|
||||
case 'upload.php':
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$default_action ) {
|
||||
switch ( $screen->id ) {
|
||||
case 'upload':
|
||||
$default_action = array('media-new.php' => array(__('New Media'), 'upload_files'));
|
||||
break;
|
||||
case 'media':
|
||||
|
@ -3400,6 +3407,7 @@ function favorite_actions( $screen = null ) {
|
|||
$default_action = array('post-new.php' => array(__('New Post'), 'edit_posts'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$actions = array(
|
||||
'post-new.php' => array(__('New Post'), 'edit_posts'),
|
||||
|
|
Loading…
Reference in New Issue