Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Created March 2, 2012 07:19

Revisions

  1. ninnypants created this gist Mar 2, 2012.
    47 changes: 47 additions & 0 deletions change-featured-img-text.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    <?php
    // alter metabox titles
    add_filter('gettext', 'wps_translation_mangler', 10, 4);
    function wps_translation_mangler($translation, $text, $domain) {
    global $post;

    if (!empty($post)) {
    $translations = &get_translations_for_domain( $domain);
    if($post->post_type == 'ufcf_person'){
    if ( $text == 'Set featured image') {
    return $translations->translate( 'Set profile picture' );
    }
    if ( $text == 'Remove featured image') {
    return $translations->translate( 'Remove profile picture' );
    }
    if ( $text == 'Featured Image') {
    return $translations->translate( 'Profile Picture' );
    }
    }elseif($post->post_type == 'page'){
    if ( $text == 'Set featured image') {
    return $translations->translate( 'Set billboard image' );
    }
    if ( $text == 'Remove featured image') {
    return $translations->translate( 'Remove billboard image' );
    }
    if ( $text == 'Featured Image') {
    return $translations->translate( 'Billboard Image' );
    }
    }
    }

    // check for post type on media uploads
    if(basename($_SERVER['SCRIPT_FILENAME']) == 'media-upload.php'){
    $pst = get_post($_GET['post_id']);
    $translations = &get_translations_for_domain( $domain);
    if($pst->post_type == 'ufcf_person'){
    if($text == 'Use as featured image'){
    return $translations->translate('Use as profile picture');
    }
    }elseif($pst->post_type == 'page'){
    if($text == 'Use as featured image'){
    return $translations->translate('Use as billboard image');
    }
    }
    }
    return $translation;
    }