我设法这样做:
将JS添加到媒体上载程序:
function mediabutton(){
wp_register_script( \'mediabutton\', \'\'.WP_PLUGIN_URL.\'/magic-gallery/js/mediabutton.js\', null, null);
wp_enqueue_script( \'mediabutton\');
}
add_action(\'admin_print_scripts-media-upload-popup\',\'mediabutton\'); // Adding insert button
然后使用这个JS:
jQuery(document).ready(function() {
jQuery(\'<a href="#" id="insert_gallery" class="button">Return to gallery</a>\').insertAfter(\'.ml-submit\');
jQuery(\'#insert_gallery\').live(\'click\',function() {
self.parent.tb_remove(); // This closes the thickbox
});
});
然后我像这样迷上了tb\\U close:
tb_remove = function () {
// Your code here
alert(\'closing thickbox\');
// Original tb_remove code
jQuery("#TB_imageOff").unbind("click");
jQuery("#TB_closeWindowButton").unbind("click");
jQuery("#TB_window").fadeOut("fast",function(){jQuery(\'#TB_window,#TB_overlay,#TB_HideSelect\').trigger("tb_unload").unbind().remove();});
jQuery("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
jQuery("body","html").css({height: "auto", width: "auto"});
jQuery("html").css("overflow","");
}
jQuery(document).unbind(\'.thickbox\');
return false;
}