Frustrated that the Types Image Field still uses the old Thickbox dialog for inserting images in a custom field, as opposed to the new modal-media dialog introduced back in WordPress 3.5 (see http://wp-types.com/forums/topic/use-wordpress-3-5-media-manager-for-types-image-field/), I set about writing my own workaround … and I think I've got one. For anyone who's interested….
You have to only modify a single file:
wp-content/plugins/types/embedded/includes/fields/image.php
Find the function <strong><em>wpcf_fields_image_meta_box_js_inline()</em></strong> and replace all of the Javascript/jQuery code that appears within the
jQuery(document).ready(function(){
…
});
block. with the following:
var _custom_media = true, _orig_send_attachment = wp.media.editor.send.attachment; jQuery('.wpcf-fields-image-upload-link').click(function(e) { var send_attachment_bkp = wp.media.editor.send.attachment; var button = jQuery(this); var id = button.attr('id') + '-holder'; _custom_media = true; wp.media.editor.send.attachment = function(props, attachment){ if ( _custom_media ) { jQuery("#"+id).val(attachment.url); } else { return _orig_send_attachment.apply( this, [props, attachment] ); }; } wp.media.editor.open(button); return false; }); jQuery('.add_media').on('click', function(){ _custom_media = false; });
The above code was adapted from this very helpful post at CODESTAG:
http://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/