Skip to content

Instantly share code, notes, and snippets.

@samediamba
Created February 12, 2015 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samediamba/5387a9533002cc12f3d5 to your computer and use it in GitHub Desktop.
Save samediamba/5387a9533002cc12f3d5 to your computer and use it in GitHub Desktop.
Change the Featured Image Box and upload link Labels for Custom Post Type
/**
* Change the Featured Image Box and upload link Labels for Custom Post Type
* @link https://wordpress.org/support/topic/relabel-featured-image-on-custom-type
*/
/*This section changes the label of the image box*/
add_action('do_meta_boxes', 'change_image_box');
function change_image_box()
{
remove_meta_box( 'postimagediv', 'staff', 'side' ); /*Alter the word "Staff" to match the name of your CPT */
add_meta_box('postimagediv', __('Photo of Church Worker'), 'post_thumbnail_meta_box', 'staff', 'normal', 'high');
/*Photo of Church Worker and staff are the replacable labels and CPT names respectively*/
}
/*This section changes the label of the upload link */
add_action('admin_head-post-new.php',change_thumbnail_html);
add_action('admin_head-post.php',change_thumbnail_html);
function change_thumbnail_html( $content ) {
if ('staff' == $GLOBALS['post_type']) /* Change staff to match the name of your CPT */
add_filter('admin_post_thumbnail_html',do_thumb);
}
function do_thumb($content){
return str_replace(__('Set featured image'), __('Upload the Photo'),$content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment