Make WordPress Core


Ignore:
Timestamp:
04/06/2010 11:20:47 AM (15 years ago)
Author:
markjaquith
Message:

Make thumbnail work for custom post types even if the editor is not being displayed. props scribu. fixes #12792

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r13940 r14015  
    11441144function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
    11451145    global $content_width, $_wp_additional_image_sizes;
    1146     $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set featured image' ) . '</a></p>';
     1146
     1147    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="' . get_upload_iframe_src('image') . '" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1148    $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' ));
    11471149
    11481150    if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
     
    11541156            $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' );
    11551157        if ( !empty( $thumbnail_html ) ) {
    1156             $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
     1158            $content = sprintf($set_thumbnail_link, $thumbnail_html);
    11571159            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
    11581160        }
Note: See TracChangeset for help on using the changeset viewer.