SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot moretea's Avatar
    Join Date
    Jun 2004
    Location
    Texas, USA
    Posts
    117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Question Adding a JS with wp_register_script, wp_enqueue_script; "jquery is not defined"

    I have been messing with WordPress on localhost, but I'm having a problem adding a JavaScript to a page. In my functions.php, I have the following:
    Code PHP:
    function addMyScripts()
    {
        wp_register_script( 
                            'clever-dl',
                            get_template_directory_uri() . '/js/clever-dl.js',
                            array( 'jquery' ),
                            '20101009',
                            true
                            );
        wp_enqueue_script( 'clever-dl' );
     
    }
    add_action( 'wp_enqueue_scripts', 'addMyScripts' );
    The page appears to render accurately, with all the paths correct and scripts being called in the right places. However, Firebug is telling me that "jquery is not defined" when it tries to run my script. (I'm using "jquery" instead of "$" to avoid conflicts.) Does anyone have any idea what I might be missing? Thanks in advance for your help!

  2. #2
    SitePoint Zealot moretea's Avatar
    Join Date
    Jun 2004
    Location
    Texas, USA
    Posts
    117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    /me slaps forehead. Should have checked the capitalization in the script itself; that's jQuery with a capital Q.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •