Ticket #10928: use_as_thumbnail.diff
File use_as_thumbnail.diff, 1.7 KB (added by , 15 years ago) |
---|
-
wp-admin/includes/media.php
1101 1101 * @return string HTML form for attachment. 1102 1102 */ 1103 1103 function get_media_item( $attachment_id, $args = null ) { 1104 global $ redir_tab;1104 global $post_mime_types, $redir_tab; 1105 1105 1106 $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );1107 $args = wp_parse_args( $args, $default_args );1108 extract( $args, EXTR_SKIP );1109 1110 global $post_mime_types;1111 1106 if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) ) 1112 1107 $thumb_url = $thumb_url[0]; 1113 1108 else 1114 1109 return false; 1115 1110 1111 $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true ); 1112 $args = wp_parse_args( $args, $default_args ); 1113 extract( $args, EXTR_SKIP ); 1114 1116 1115 $toggle_on = __('Show'); 1117 1116 $toggle_off = __('Hide'); 1118 1117 … … 1141 1140 $toggle_links = " 1142 1141 <a class='toggle describe-toggle-on' href='#'>$toggle_on</a> 1143 1142 <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>"; 1144 if ( 'image' == $type)1145 $toggle_links .= "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"" . intval( $attachment_id ) . "\");return false;'>" . esc_html__( "Use forthumbnail" ) . "</a>";1143 if ( 'image' == $type && get_post_image_id($_GET['post_id']) != $attachment_id ) 1144 $toggle_links .= "<a class='wp-post-thumbnail' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\");return false;'>" . esc_html__( "Use as thumbnail" ) . "</a>"; 1146 1145 } else { 1147 1146 $class = 'form-table'; 1148 1147 $toggle_links = '';