WordPress.org

Ready to get started?Download WordPress

Forums

WordPress and Jquery Plugins? (1 post)

  1. squeaker2
    Member
    Posted 3 years ago #

    I have developed quite a few WordPress websites and I am stumped on this one. I am trying to use the BBQ plugin (https://github.com/cowboy/jquery-bbq/raw/v1.2.1/jquery.ba-bbq.js), but this is happening with ANY plugin that I use. I have included the Jquery and the plugin source in my header file, and I checked the source to make sure that they were loading. However, when trying to use the plugin functions it says they are undefined. I am assuming this is because of some tweak in WordPress.

    I tried using wp_enqueue_script with an INIT method -

    function load_scripts() {
        wp_enqueue_script('jquery');
    	wp_enqueue_script('urlChange', get_template_directory_uri() . '/js/jquery.url.js', array('jquery'));
    }    
    
    add_action('init', 'load_scripts');

    to put them in the header file, but then I cannot use the $ for JQuery, I have to default to using the JQuery call. Its not a big deal that I have to use the JQuery call, but I think the plugin .js file must not work correctly when doing this. If I COPY-PASTE the ENTIRE source of the .js file into a jQuery(document).ready function on the page then it WORKS!

    Why can I not register this source externally for ALL pages to be able to use? This makes no sense. I have spent hours trying to figure this out, any help would be appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic