Jquery issues on wordpress run website

Hello I have issues with jquery on my site. It was working fine till I created a plugin that uses jquery. I enqueue the scripts:

wp_enqueue_style("nstdt","***/wp-content/plugins/***/css/nstdt.css");
wp_enqueue_style("pagecss","***/wp-content/plugins/***/css/jPaginator.css");
wp_enqueue_script("nstdt","***/wp-content/plugins/***/js/nstdt.js",array("jquery"));
wp_enqueue_script("paginate","***/wp-content/plugins/***/js/jPaginator.js",array("jquery","jquery-ui-core","jquery-ui-slider"));

The * is just obscuring the site url.

Read More

the nstdt.js is the jquery I wrote, and the jPaginator.js is a script I got online.

ndtdt starts with this:

    jQuery.noConflict();
jQuery(document).ready(function($){

and jPaginator.js starts like:

(function($) {
$.fn.jPaginator = function(o) {

The theme itself has a small script that runs called roundabout with this in the header.php

<?php  wp_enqueue_script( 'jquery' ); ?>
<script type="text/javascript">
var $j = jQuery.noConflict();

   $j(document).ready(function() {
                var interval;

These are the errors I am getting:

jQuery is not defined
Line 7

    You must use this plugin with a unique element
   ***/wp-includes/js/jquery/jquery.js?ver=1.7.1
    Line 2

The unique element thing looks like it might be an error from jPaginator, since this is the first line in the code:

if (this.size() != 1)
    $.error( 'You must use this plugin with a unique element' );

So I am wondering if anyone has any ideas. And yes I did check the site via firebug and jquery is loading, and is the first thing loaded. No 404 errors.

Related posts

Leave a Reply

2 comments

  1. just make sure that the jQuery selector you use to initialize the plugin contains only one element

    for instance :

    // where #test1 is unique in your page
    $("#test1").jPaginator({ <your paramaters>});
    
    
    
    // or for a list ( ie : $(".myclass").length > 1 )
    $(".myclass").each(function() {
        $(this).jPaginator({ <your paramaters>});
    });
    
  2. Try taking <?php wp_enqueue_script( 'jquery' ); ?> out. WordPress already loads jQuery by default, and you don’t even need to call jQuery.noConflict().

    Just go straight into jQuery(document).ready(function($){...