Only show Use for thumbnail link for image attachments. see #10928

git-svn-id: https://develop.svn.wordpress.org/trunk@12059 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2009-10-19 16:36:21 +00:00
parent 945ae5b936
commit d3f1d779f3

View File

@ -1151,7 +1151,7 @@ function get_media_item( $attachment_id, $args = null ) {
if ( isset($post_mime_types) ) { if ( isset($post_mime_types) ) {
$keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type)); $keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
$type = array_shift($keys); $type = array_shift($keys);
$type = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />"; $type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
} }
$form_fields = get_attachment_fields_to_edit($post, $errors); $form_fields = get_attachment_fields_to_edit($post, $errors);
@ -1160,8 +1160,9 @@ function get_media_item( $attachment_id, $args = null ) {
$class = empty($errors) ? 'startclosed' : 'startopen'; $class = empty($errors) ? 'startclosed' : 'startopen';
$toggle_links = " $toggle_links = "
<a class='toggle describe-toggle-on' href='#'>$toggle_on</a> <a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
<a class='toggle describe-toggle-off' href='#'>$toggle_off</a> <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"" . intval( $attachment_id ) . "\");return false;'>" . esc_html__( "Use for thumbnail" ) . "</a>"; if ( 'image' == $type )
$toggle_links .= "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"" . intval( $attachment_id ) . "\");return false;'>" . esc_html__( "Use for thumbnail" ) . "</a>";
} else { } else {
$class = 'form-table'; $class = 'form-table';
$toggle_links = ''; $toggle_links = '';
@ -1197,7 +1198,7 @@ function get_media_item( $attachment_id, $args = null ) {
} }
$item = " $item = "
$type $type_html
$toggle_links $toggle_links
$order $order
$display_title $display_title