Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(document).ready(function($){
- $('.upload-button').click(function(e) {
- var button = $(this);
- var input = button.siblings('input:text').first();
- var frame = wp.media( {
- title : button.data( 'uploader_title' ),
- multiple : false,
- library : { type : button.data( 'limit_type' )},
- button : { text : button.data( 'uploader_button_text' ) }
- } );
- frame.on( 'select', function() {
- var attachment = frame.state().get( 'selection' ).first().toJSON();
- $(input).val(attachment.url);
- } );
- frame.open();
- return false;
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement