Some useful tutorial to all authors here about How to use WordPress 3.5 Media Uploader in Theme Options.
Special thanks to Ram Ratan Maurya
DesignPuma said
Some useful tutorial to all authors here about How to use WordPress 3.5 Media Uploader in Theme Options.
Special thanks to Ram Ratan Maurya
Thanks for bringing this here. Previous code had some bugs which was preventing WordPress to ad new media from edit post screen once you uploaded a file which uses this code.
However, I have solved it and it works fine now. If you have used this code in your theme I suggest you to update it with latest code on site. Thanks.
Thanks for sharing this resource. Although the old uploader is still there(WordPress allows us to make use of it to not break themes) keeping steps with WordPress is a must as it gets better and better each month.
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
The solution in the tutorial works but it only restores the default behaviour when the media uploader is opened by clicking on the “add media” button. This may not be always the case as a plugin or theme could use javascript for whatever reason.
Here’s an alternate method which relies on events to restore the original function after the image has been added or the uploader closed by clicking “close” button or using “ESC” key:
https://gist.github.com/4452118BF
DesignPuma said+1. Thanks!
Some useful tutorial to all authors here about How to use WordPress 3.5 Media Uploader in Theme Options.
Special thanks to Ram Ratan Maurya
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
The new media uploader api is amazing as much as its complete lack of documentation. So i started digging into the javascript sources, a few hours (and a good amount of blasphemies) later, i was able to come out with a working example:
pixelentity, that snippet does great. I was just about to post the same here. At the end result, I came up with same, but a slight different version of the same.
Here is the link to WP3.5 API
- Sold between 100 000 and 250 000 dollars
- Won a Competition
- Author was Featured
- Item was Featured
- Referred between 500 and 999 users
- Author had a Free File of the Month
- Author had a File in an Envato Bundle
- Bought between 10 and 49 items
Needed to add a custom image filter, again no docs on the subject, most likely broken the swearing world record, here’s an example:
WordPress 3.5 media upload api: toolbar with custom filter
BF
- Exclusive Author
- Sold between 50 000 and 100 000 dollars
- Has been a member for 2-3 years
- Bought between 1 and 9 items
- Referred between 50 and 99 users
RamRatanMaurya said
pixelentity, that snippet does great. I was just about to post the same here. At the end result, I came up with same, but a slight different version of the same. Here is the link to WP3.5 API
And use the on() function instead of live() because it have been deprecated.
- Exclusive Author
- Sold between 50 000 and 100 000 dollars
- Has been a member for 2-3 years
- Bought between 1 and 9 items
- Referred between 50 and 99 users
pixelentity said
Needed to add a custom image filter, again no docs on the subject, most likely broken the swearing world record, here’s an example: BF
Thanks for sharing this snippet ,dude!
