发布时this question @PontusAbrahamsson很好地回答了您:
function wpse_111428_change_feature_image_admin( $content )
{
global $post;
$size = 100;
$id = get_post_meta( $post->ID, \'_thumbnail_id\', true );
if( $id )
{
return wp_get_attachment_link( $id, array( $size, $size ) );
}
}
add_filter( \'admin_post_thumbnail_html\', \'wpse_111428_change_feature_image_admin\' );
只需将其替换为使用以下代码的修改版本
\\wp-admin\\includes\\post.php
:
function wpse_111435_change_feature_image_admin( $content, $post_id = null ) {
$size = 100; // set here your size
$thumb = $post_id ? get_post_meta( $post_id, \'_thumbnail_id\', true ) : false;
if( $thumb ) {
$set_thumbnail_link = \'<p class="hide-if-no-js"><a title="\' . esc_attr__( \'Set featured image\' );
$set_thumbnail_link .= \'" href="%s" id="set-post-thumbnail" class="thickbox">\' . __( \'Set featured image\' ) . \'</a></p>\';
$upload_iframe_src = esc_url( get_upload_iframe_src(\'image\', $post_id ) );
$content = \'<div id="draggable" class="ui-widget-content"><p>\' . __(\'Featured Image Code\') . \'</p>\'; // your html
$content .= wp_get_attachment_image( $thumb, array( $size, $size ) ) . \'</div>\'; // this one output the image
$content .= sprintf( $set_thumbnail_link, $upload_iframe_src );
$ajax_nonce = wp_create_nonce( \'set_post_thumbnail-\' . $post_id );
$content .= \'<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\\\'\' . $ajax_nonce . \'\\\');return false;">\';
return $content . esc_html__( \'Remove featured image\' ) . \'</a></p>\';
}
return $content;
}
add_filter( \'admin_post_thumbnail_html\', \'wpse_111435_change_feature_image_admin\', 20, 2 );