Since re-developing my portfoliofor this website, I found that the media picker script which I was using to select portfolio images should be updated.
Originally the first version of the script was using the old WordPress Thickbox modal. Since WordPress 3.5 it has been possible to use the new WordPress modal.
Although I found it difficult to find any documentation, eventually I was able to implement the new modal into my image picker script which I was using for Portfolio images.
The script I use is run as a custom META Box in a Custom type post. The JavaScript code below is used to allow the WordPress 3.5 modal to open up when a button with a class of 'upload_image_button' is clicked.
This actual code was adapted slightly from ablog post by Mike Jolley. I had to make the modifications to the code because I had areas for three images to be selected and did not want to have a mass amount of code for each upload button. Instead this code which I amended from Mike Jolley will cleverly work out where the image URL should be placed dependant on which upload button you have clicked upon. Below is the HTML code which is used to display the form elements in the Custom META box.
Alternatively you can view all the mark-up together.
I cannot thank Mike Jolley enough. If you found his code useful then I highly recommend you visit his website and thank him yourself.
Cannot see my code snippets? Some devices may not load them properly. View them here: