Make WordPress Core


Ignore:
Timestamp:
05/31/2015 04:53:12 PM (10 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/media.php

    r32672 r32673  
    14941494    if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
    14951495        && post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
     1496       
     1497        $calling_post = get_post( $calling_post_id );
     1498        $calling_post_type_object = get_post_type_object( $calling_post->post_type );
     1499
    14961500        $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
    1497         $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html__( "Use as featured image" ) . "</a>";
     1501        $thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html( $calling_post_type_object->labels->use_featured_image ) . "</a>";
    14981502    }
    14991503
     
    17371741 */
    17381742function media_upload_header() {
     1743
    17391744    $post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
    1740     echo '<script type="text/javascript">post_id = ' . $post_id . ";</script>\n";
     1745
     1746    if ( ! empty( $post_id ) ) {
     1747        $post_type = get_post_type( $post_id );
     1748    } else {
     1749        $post_type = '';
     1750    }
     1751
     1752    echo '<script type="text/javascript">post_id = ' . $post_id . ';post_type = ' . $post_type . ';</script>';
    17411753    if ( empty( $_GET['chromeless'] ) ) {
    17421754        echo '<div id="media-upload-header">';
Note: See TracChangeset for help on using the changeset viewer.