Created
October 31, 2018 21:16
-
-
Save andrekeher/a1bc730148fea6d46eddc236fed2a663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$('#carregar').on('click', function(e) { | |
e.preventDefault(); | |
var file_frame = wp.media({ | |
title: 'Materiais', | |
button: { | |
text: 'Configurar', | |
}, | |
multiple: false | |
}); | |
file_frame.on('select', function() { | |
var attachment = file_frame.state().get('selection').first().toJSON(); | |
$('#_url').val(attachment.url); | |
}); | |
file_frame.open(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment