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-includes/script-loader.php

    r32623 r32673  
    571571        ));
    572572
    573         $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    574         did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    575             'setThumbnail' => __( 'Use as featured image' ),
     573        $setPostThumbnailL10n = array(
     574            'setThumbnail' => __( 'Use as featured image' ), // Back compat
    576575            'saving' => __( 'Saving...' ),
    577576            'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    578577            'done' => __( 'Done' )
    579         ) );
     578        );
     579
     580        foreach ( get_post_types( null, 'objects' ) as $post_type_object ) {
     581            if ( isset( $post_type_object->labels->use_featured_image ) ) {
     582                $setPostThumbnailL10n[ "setThumbnail_{$post_type_object->name}" ] = $post_type_object->labels->use_featured_image;
     583            }
     584        }
     585        $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
     586        did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', $setPostThumbnailL10n );
    580587
    581588        // Navigation Menus
Note: See TracChangeset for help on using the changeset viewer.