WordPress.org

Support

Support » Themes and Templates » [Resolved] Add Media

[Resolved] Add Media

  • Add Media button have stop working in this theme. Insert Media dialog is shown, but I am unable to add any image into the post. I found following error in a browser (Safari) console:

    [Error] TypeError: ‘undefined’ is not a function (evaluating ‘uploadID.val(imgurl)’)
    send_to_editor (media-upload-script.js, line 17)
    insert (load-scripts.php, line 101)
    (anonymous function) (load-scripts.php, line 101)
    c (load-scripts.php, line 4)
    fireWith (load-scripts.php, line 4)
    (anonymous function) (load-scripts.php, line 96)
    c (load-scripts.php, line 4)
    fireWith (load-scripts.php, line 4)
    k (load-scripts.php, line 6)
    r (load-scripts.php, line 6)

Viewing 2 replies - 1 through 2 (of 2 total)
  • vibhorp

    @vibhorp

    Hi,

    The issue is that there is a Javascript conflict which is preventing media uploader from working properly.

    I would like to suggest you a workaround:

    -> Open functions.php file .
    -> Comment the line number 42
    which is ‘wp_enqueue_script(‘my-upload-admin’,get_bloginfo(‘template_directory’).’/js/media-upload-script.js’,array(‘media-upload’,’thickbox’));’

    These changes will enable your ‘add media’ button in all posts. In the mean time we are working on fixing the bug.

    Alternatively you can also attach an image using the “Featured Image” feature.

    By the way, can you share the website URL with us?

    vibhorp

    @vibhorp

    Hi,

    The issue has been resolved .

    Just replace the whole code given below into the
    ‘media-upload-script.js’ .

    You will find this file into ‘/themedirectory/js/media-upload- script.js’

    CODE:

    jQuery(document).ready(function() {
    
        var uploadID = ''; /*setup the var*/
    
        jQuery('.upload_image_button').click(function() {
        uploadID = jQuery(this).prev('input'); /*grab the specific input*/
    
        formfield = jQuery('.upload').attr('name');
        tb_show('', 'media-upload.php?type=image&TB_iframe=true');
    
            window.original_send_to_editor = window.send_to_editor;
    	window.send_to_editor = function(html)
            {
    
    	    imgurl = jQuery('img',html).attr('src');
    
                uploadID.val(imgurl); /*assign the value to the input*/
                tb_remove();
            };
    	return false;
         });
         });

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    We will fix this bug with the new version update .

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Add Media’ is closed to new replies.