-
-
Save illucent/11008633 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <h3>My Picture (1)</h3> | |
| <input type="text" id="my_media_1" name="my_media_1" value="" /> | |
| <a class="media-upload" href="JavaScript:void(0);" rel="my_media_1">Select File</a> | |
| <h3>My Picture (2)</h3> | |
| <input type="text" id="my_media_2" name="my_media_2" value="" /> | |
| <a class="media-upload" href="JavaScript:void(0);" rel="my_media_2">Select File</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery('document').ready(function(){ | |
| jQuery('.media-upload').each(function(){ | |
| var rel = jQuery(this).attr("rel"); | |
| jQuery(this).click(function(){ | |
| window.send_to_editor = function(html) { | |
| imgurl = jQuery('img', html).attr('src'); | |
| jQuery('#'+rel).val(imgurl); | |
| tb_remove(); | |
| } | |
| formfield = jQuery('#'+rel).attr('name'); | |
| tb_show(null, 'media-upload.php?post_id=0&type=image&TB_iframe=true'); | |
| return false; | |
| }); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('admin_print_scripts-'.$hook_suffix, 'my_admin_scripts'); | |
| add_action('admin_print_styles-'.$hook_suffix, 'my_admin_styles'); | |
| function my_admin_styles() { | |
| wp_enqueue_style('thickbox'); | |
| } | |
| function my_admin_scripts() { | |
| wp_enqueue_script('media-upload'); | |
| wp_enqueue_script('thickbox'); | |
| wp_enqueue_script('jquery'); | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment