Title: Adding upload/insert photo media function to plugin
Last modified: August 19, 2016

---

# Adding upload/insert photo media function to plugin

 *  [shackle](https://wordpress.org/support/users/shackle/)
 * (@shackle)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/adding-uploadinsert-function-to-plugin/)
 * Hi I’m trying to add the upload/insert photo media function to a plugin that 
   currently doesn’t support or include it. (shopp in the product edit pages)
 * I had it working by viewing source and coping the code for the <script></script
   > javascript and the div id=”media-buttons” class=”hide-if-no-js”> code.
 * This method was working, but not working now I think it has to do with the page
   id’s or something. The zoom box won’t come up when I click the icons anymore.
 * Any cleaner and working methods of adding that feature to pages that don’t have
   it?
 *     ```
       <script type="text/javascript">
       //<![CDATA[
       addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
       var userSettings = {'url':'/hadpress/','uid':'1','time':'1267931133'};
       var ajaxurl = 'http://hosting-and-designs.com/hadpress/wp-admin/admin-ajax.php', pagenow = 'post', adminpage = 'post-php',  thousandsSeparator = ',', decimalPoint = '.';
       //]]>
       </script>
       ```
   
 *     ```
       <div id="media-buttons" class="hide-if-no-js">
       Upload/Insert
       	<a href="media-upload.php?post_id=3&type=image&TB_iframe=true" id="add_image" class="thickbox" title='Add an Image' onclick="return false;"><img src='images/media-button-image.gif' alt='Add an Image' /></a>
   
       	<a href="media-upload.php?post_id=3&type=video&TB_iframe=true" id="add_video" class="thickbox" title='Add Video' onclick="return false;"><img src='images/media-button-video.gif' alt='Add Video' /></a>
       	<a href="media-upload.php?post_id=3&type=audio&TB_iframe=true" id="add_audio" class="thickbox" title='Add Audio' onclick="return false;"><img src='images/media-button-music.gif' alt='Add Audio' /></a>
       	<a href="media-upload.php?post_id=3&TB_iframe=true" id="add_media" class="thickbox" title='Add Media' onclick="return false;"><img src='images/media-button-other.gif' alt='Add Media' /></a>
       		</div>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [shackle](https://wordpress.org/support/users/shackle/)
 * (@shackle)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/adding-uploadinsert-function-to-plugin/#post-1415274)
 * It does howevwer work fine when using post/page.

Viewing 1 replies (of 1 total)

The topic ‘Adding upload/insert photo media function to plugin’ is closed to new
replies.

 * 1 reply
 * 1 participant
 * Last reply from: [shackle](https://wordpress.org/support/users/shackle/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/adding-uploadinsert-function-to-plugin/#post-1415274)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
