WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/31/2015 04:53:12 PM (7 years ago)
Author:
johnbillion
Message:

Introduce featured_image, set_featured_image, remove_featured_image, and use_featured_image post type labels when registering a post type in order to override the 'Featured Image' text and its related phrases.

Props johnbillion, mordauk, valendesigns.
Fixes #19257.

File:
1 edited

Legend:

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

    r32643 r32673  
    13631363    global $content_width, $_wp_additional_image_sizes;
    13641364
    1365     $post = get_post( $post );
    1366 
    1367     $upload_iframe_src = esc_url( get_upload_iframe_src('image', $post->ID ) );
    1368     $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
    1369     $content = sprintf( $set_thumbnail_link, $upload_iframe_src, esc_html__( 'Set featured image' ) );
     1365    $post               = get_post( $post );
     1366    $post_type_object   = get_post_type_object( $post->post_type );
     1367    $set_thumbnail_link = '<p class="hide-if-no-js"><a title="%s" href="%s" id="set-post-thumbnail" class="thickbox">%s</a></p>';
     1368    $upload_iframe_src  = get_upload_iframe_src( 'image', $post->ID );
     1369
     1370    $content = sprintf( $set_thumbnail_link,
     1371        esc_attr( $post_type_object->labels->set_featured_image ),
     1372        esc_url( $upload_iframe_src ),
     1373        esc_html( $post_type_object->labels->set_featured_image )
     1374    );
    13701375
    13711376    if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
     
    13781383        if ( !empty( $thumbnail_html ) ) {
    13791384            $ajax_nonce = wp_create_nonce( 'set_post_thumbnail-' . $post->ID );
    1380             $content = sprintf( $set_thumbnail_link, $upload_iframe_src, $thumbnail_html );
    1381             $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>';
     1385            $content = sprintf( $set_thumbnail_link,
     1386                esc_attr( $post_type_object->labels->set_featured_image ),
     1387                esc_url( $upload_iframe_src ),
     1388                $thumbnail_html
     1389            );
     1390            $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html( $post_type_object->labels->remove_featured_image ) . '</a></p>';
    13821391        }
    13831392        $content_width = $old_content_width;
Note: See TracChangeset for help on using the changeset viewer.