WordPress.org

Ready to get started?Download WordPress

Forums

Loading jQuery.Dialog via enqueue_script in plugin admin area (2 posts)

  1. palamedes
    Member
    Posted 4 years ago #

    Howdy all..

    I am writing a plugin and I have the settings area defined and working fairly nicely.. but I wanted to add some spiffy jQuery stuff using the jquery.ui and jquery.dialog functionality..

    But I can't seem to get jquery.dialog to load..

    At the bottom of my widget definition (which is a class) I have:

    add_action("init", array('myWidget','init'),1000,0);

    This calls myWidget::init() which in turn looks like this;

    function init() {
        wp_enqueue_script('jquery-dialog');
        add_action('admin_menu', array('myWidget', 'registerAdminPage'));
    // More stuff..
    }

    The very first thing I'm doing is trying to enqueue jquery-dialog to be loaded..

    I have tried putting that call in different places and it never seems to work.

    jQuery.dialog is simply not defined..

    How do I go about loading jquery-dialog?

  2. spencersokol
    Member
    Posted 4 years ago #

    Looking at the codex page for wp_enqueue_script shows that it's called 'jquery-ui-dialog'. The dialog also depends on the ui core, so you'll need to include that too.

    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
    wp_enqueue_script('jquery-ui-dialog');

    I think there may actually be more to it... there's probably some default styles to load with wp_enqueue_style.

Topic Closed

This topic has been closed to new replies.

About this Topic