I am working on a custom theme in which I have created an instance of the WordPress media uploader to upload video files to a given section. Here is my JS code:
//click function on the video requester
$('.video_requester')
.on('click', function (e) {
e.preventDefault();
var divisionID = String(e.target.id); // the id of the clicked div
var custom_uploader = wp.media({
title: 'Add Video To Section',
button: {
text: 'Save Video'
},
library: {
type: 'video'
},
multiple: false, // Set this to true to allow multiple files to be selected
//frame: 'post'// uncomment to see the post frame
})
.on('select', function () {
var attachment = custom_uploader.state()
.get('selection')
.first()
.toJSON();
var extension = attachment.url.substr((attachment.url.lastIndexOf('.') + 1)); //read what is after the last.
alert(attachment.url);
})
.open();
});
I want to add an extra tab to the media requester pop up.
In this post http://pucksart.com/wordpress-javascript-media-library/ there is something that can help you. Basically you have to extend the media library router, adding a new value (for the new tab)