WordPress.org

Ready to get started?Download WordPress

Forums

Simple jQuery UI Dialog with WordPress!? (1 post)

  1. th23
    Member
    Posted 3 years ago #

    Hi together,

    I think I am a bit lost in the depths of registering, enqueing and executing JS in WP: All I want to do, is to display on a page like this.

    I understand, that all the required JS (jQuery UI) comes with each standard WP installation, correct?

    I found the following code snippets in the Codex documentation:

    <?php
    function my_init_method() {
        if (!is_admin()) {
            wp_enqueue_script( 'jquery' );
        }
    }    
    
    add_action('init', 'my_init_method');
    ?>

    Do I need to register the jQuery / jQuery UI script at all - or is this regsitered by default?

    How do I enqueue the script on the pages I require it? Just like above? Do I need to make sure to check, if it's not already enqueued by another script?

    And last but not least, how do I include my intended behaviour then? I understand, I need a snippet like the one below, but how do I include that on the page?

    jQuery(document).ready(function(){
        jQuery(#somefunction) ...
    });

    Maybe there is a tutorial somewhere explaining that comprehensively, then I would really appreciate to point me there!

    Thanks!

    Best regards
    th23

Topic Closed

This topic has been closed to new replies.

About this Topic