Created
March 2, 2012 07:19
-
-
Save ninnypants/1956396 to your computer and use it in GitHub Desktop.
Change featured image text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome. Thanks for posting this.