Changing Media Upload Text
This modification will change the media upload text from "Insert into Post" to "Insert into Theme Options"!
1st open nhp-options.php and find line 115 should look like this:
$args['page_slug'] = 'nhp_theme_options';
nhp_theme_options is the default page slug that i will be using in this tutorial! If you have a custom page slug change the code accordingly!
now in the same file (nhp-options.php) add the following code at the very bottom before the end of php ?>
add_action( 'admin_init', 'nhp_media_upload_text' ); function nhp_media_upload_text() { global $pagenow; if ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) { // Now we'll replace the 'Insert into Post Button' inside Thickbox add_filter( 'gettext', 'replace_thickbox_text' , 1, 3 ); } }
function replace_thickbox_text($translated_text, $text, $domain) { if ('Insert into Post' == $text) { $referer = strpos( wp_get_referer(), 'nhp_theme_options' ); if ( $referer != '' ) { return __('Insert into Theme Options', 'wptuts' ); } } return $translated_text; }
2nd open / options / fields / upload / field_upload.js and in line 19 you will find:
tb_show('', 'media-upload.php?type=image&post_id=0&TB_iframe=true');
change that into:
tb_show('', 'media-upload.php?referer=nhp_theme_options&type=image&post_id=0&TB_iframe=true');
Thats all!