• I keep getting this error.

    I just have my plugin installed on my WP site which calls some .js files with jquery and jquery-ui-core as dependencies.

    I call them like so:

    wp_enqueue_script(
                'vkrwpsprojs',
                plugins_url( '/js/vkrwpsprojs.js', __FILE__ ),
                array( 'jquery' )
            );
    
            wp_enqueue_script(
                'fancybox',
                plugins_url( '/js/jquery.fancybox.js', __FILE__ ),
                array( 'jquery-ui-core' )
            );

    The head sections of my page ( where the .js files start to get includes ) looks like so:

    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js?ver=4.0" type="text/javascript"></script>
        <script src="http://l/demorwpspro/wp-includes/js/jquery/jquery.js?ver=1.11.1" type="text/javascript"></script>
        <script src="http://l/demorwpspro/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1" type="text/javascript"></script>

    Is the problem that jquery-ui is called before jquery? If so, how to make jquery appear before jquery-ui? The ordering that exists now shoud include jquery first and then jquery-ui, but it’s not.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi vk011,
    The problem is from this code

    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js?ver=4.0" type="text/javascript"></script>
        <script src="http://l/demorwpspro/wp-includes/js/jquery/jquery.js?ver=1.11.1" type="text/javascript"></script>
        <script src="http://l/demorwpspro/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1" type="text/javascript"></script>

    No need for you to do that WordPress comes bundled with jquery and jquery ui.

    To know more about adding javascript files to your WordPress themes or plugin visit this link http://codex.ww.wp.xz.cn/Function_Reference/wp_enqueue_script

    So remove the highlighted files and lets know if the problem still persist.

    Thread Starter vk011

    (@vk011)

    Hello,

    For some reason the ui bundle didn’t work for me for drag and drop sorting.

    I still included the script from google but for admin backend only and it works now without errors, so I don’t think i will keep messing with it.

    The bundled ui for some reason did not recognize the “sortable” function, which I needed for drag n drop reordering.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘ReferenceError: jQuery is not defined’ is closed to new replies.