I want to add the media uploader in the theme options page. If I add following code in the options page, the media uploader works fine there, but it creates problem in the standard posts featured image. It does not let me select any image from there.
Would it be because I'm adding it in wrong way?
if ( ! did_action( 'wp_enqueue_media' ) ){
wp_enqueue_media();
}
Here's the uploading function I'm using:
$('#upload_img').click(function(){
wp.media.editor.send.attachment = function(props, attachment){
$('#theme_options\\[img_url\\]').val(attachment.url);
}
wp.media.editor.open(this);
return false;
});