WordPress.org

Forums

How to use wordpress 3.5 media uploader in my plugin? (3 posts)

  1. myefs
    Member
    Posted 2 years ago #

    I'm trying to make a wordpress plugin and can't figure out how to call the wordpress 3.5 new media uploader, I don't know javascript so I'm trying to just figure it out from the examples. I have found this tutorial but can't get it to work

    Please help me with this, it's urgent!

    This is how I use it:

    1.I have the script in a separate js file

    2.I add this before the function displaying the form

    wp_enqueue_script('media_uploader', '/wp-content/plugins/video_manager/media_uploader.js', array('jquery') );
    3.html output

    <div class="uploader">
      <input type="text" name="settings[_unique_name]" id="_unique_name" />
      <input class="button" name="_unique_name_button" id="_unique_name_button" value="Upload" />
    </div>

    Nothing happpens when I press the upload button

  2. Alex Furr
    Member
    Posted 2 years ago #

    Hi - I'm also having major problems getting to work. it shouldn't be this hard!
    I'm not a novice plugin writer but having no luck at all getting this going.

    Ideally a simple example in a plugin so we can figure out what we're doing wrong :(

    Any help from any pros out there?
    Alex

  3. johnbhartley
    Member
    Posted 1 year ago #

    Not sure if you found your answer, but you probably need to add wp_enqueue_media(); somewhere in your function. That will give you all the items for the media uploader. Check the two links for more details.

    http://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/

    http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in-plugins/

Topic Closed

This topic has been closed to new replies.

About this Topic