Add new media uploader at frontend for wp 3.5+

Add this code to your theme’s functions.php file:

function add_media_upload_scripts() {
    if ( is_admin() ) {
         return;
       }
    wp_enqueue_media();
}
add_action('wp_enqueue_scripts', 'add_media_upload_scripts');

This will cause the the media upload files to load on your front end pages. If you would like to load them only on one specific page where they will be needed, you can wrap wp_enqueue_media() in an is_page() statement to check to see if the page being displayed is the specific page you need.

After that, you can follow the instructions in this tutorial: http://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/

Leave a Comment

tech