Make WordPress Core


Ignore:
Timestamp:
10/15/2009 12:57:16 PM (17 years ago)
Author:
markjaquith
Message:

Post thumbnail removal functionality (only allowed for replacement before). props scribu. see #10928

File:
1 edited

Legend:

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

    r12018 r12036  
    116116
    117117function _wp_post_thumbnail_html( $thumbnail_id = NULL ) {
     118        $content = '<p class="hide-if-no-js"><a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a></p>';
     119
    118120        if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
    119121                $thumbnail_html = wp_get_attachment_image($thumbnail_id, array( 266, 266 ) );
    120                 if ( !empty( $thumbnail_html ) )
    121                         return apply_filters( 'admin_post_thumbnail_html', '<a href="#" id="cws-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>' );
    122         }
    123         return apply_filters( 'admin_post_thumbnail_html', '<a href="#" id="cws-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . esc_html__( 'Set thumbnail' ) . '</a>' );
     122                if ( !empty( $thumbnail_html ) ) {
     123                        $content = '<a href="#" id="set-post-thumbnail" onclick="jQuery(\'#add_image\').click();return false;">' . $thumbnail_html . '</a>';
     124                        $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail();return false;">' . esc_html__( 'Remove thumbnail' ) . '</a></p>';
     125                }
     126        }
     127
     128        return apply_filters( 'admin_post_thumbnail_html', $content );
    124129}
    125130
Note: See TracChangeset for help on using the changeset viewer.