Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<script type='text/javascript'>
var file_frame;
jQuery('.upload_image_button').live('click', function( event ){ // '.upload_image_button' is the ID of my button that opens the Media window
formfield = jQuery(this).prev().attr('name'); // Needed for the script to send the URL to the appropriate text box
if ( file_frame ) {;
file_frame = ={
title: 'Choose a Portfolio Image',
button: {
text: 'Choose Image'
multiple: false // Set to true to allow multiple files to be selected
file_frame.on( 'select', function() {
attachment = file_frame.state().get('selection').first().toJSON();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment