Allow pseudo post types attachment:audio and attachment:video to get the media modal on Edit Media when they support featured images.

Introduces `post_supports_thumbnails( $post )` and `theme_supports_thumbnails( $post )` to cut down on duplicated code everytime this needs to be checked. There will be more cases forthcoming.

See #26631.



git-svn-id: https://develop.svn.wordpress.org/trunk@27209 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-02-20 17:49:30 +00:00
parent 3776fd7d5d
commit ae603ef26d
2 changed files with 52 additions and 2 deletions
+7 -1
View File
@@ -24,7 +24,13 @@ $post_ID = isset($post_ID) ? (int) $post_ID : 0;
$user_ID = isset($user_ID) ? (int) $user_ID : 0;
$action = isset($action) ? $action : '';
if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) {
$media_type = false;
if ( 'attachment' && $post_ID ) {
$post = get_post( $post_ID );
$media_type = post_supports_thumbnails( $post );
}
if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'thumbnail' ) || $media_type ) {
add_thickbox();
wp_enqueue_media( array( 'post' => $post_ID ) );
}