• I’m trying to add a media uploader to a widget/plugin and I’m at the stage where I need to add a picture from the media library (or upload a new one).

    I added some javascript and added an event to a button in the plugin. This event gets fired (because the alert is displayed), but the thickbox does not show up.

    Here’s the JS code:

    jQuery(document).ready(function() {
        jQuery('.upload_image_button').click(function() {
            alert('This alert is displayed');
            tb_show('Upload a Image', 'media-upload.php&type=image&TB_iframe=true', false);
            return false;
        });
    });

    And it is being included like this to be dependent on thickbox and media upload:

    wp_enqueue_script('my_upload_script', get_template_directory_uri() . '/js/script.js', array('jquery', 'thickbox', 'media-upload'));

    Why isn’t the Thickbox displayed?

Viewing 1 replies (of 1 total)
  • Thread Starter GTHvidsten

    (@gthvidsten)

    Wow, this turned out to be more difficult than it at first seemed. I have the same question going on stackexchange as well and it has no answers either! (and they’re usually quick to come up with an answer there)

    An alternative question is then to not be as specific and just ask the following:

    How can I use the media library in a custom widget?

Viewing 1 replies (of 1 total)
  • The topic ‘Showing a Thickbox (tb_show) does nothing’ is closed to new replies.