0

I hate to add to the multitude of "script not enqueueing" questions, but I can't seem to figure out why my "tablesorter" scripts won't enqueue. The other script (customsjs) in the same directory is enqueuing nicely, but the tablesorter scripts won't.

function load_customs(){

    wp_enqueue_script( 'jquery-ui-datepicker');
    wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');

    wp_register_script( 'customjs', plugins_url( '/js/site-customjs.js', __FILE__ ), array('jquery') );
    wp_enqueue_script( 'customjs' );

    wp_register_script( 'tablesorterjs', plugins_url( '/js/jquery.tablesorter.js', __FILE__ ), array('jquery') );
    wp_enqueue_script( ' tablesorterjs' );

    wp_register_script( 'tablesorterfunctions', plugins_url( '/js/tablesorter.js', __FILE__ ), array('jquery') );
    wp_enqueue_script( ' tablesorterfunctions' );

    wp_enqueue_style( 'tablesorter', plugins_url( '/css/tablesorter/style.css', __FILE__ ) );
}
add_action('wp_enqueue_scripts', 'load_customs');

I've verified that the files are in their appropriate location and the console in Chrome isn't throwing any errors.

To clarify - my problem is the TableSorter JS files not enqueueing. The TableSorter CSS file enqueues just fine.

Is anyone seeing what the problem might be? Thanks!

10
  • do have error for the javascript contained in the external file telling me <noscript> was incorrect Feb 1, 2016 at 18:05
  • I do not have an error. Thank you for the link to the Codex. That is how I built my calls. Are you seeing something that I missed that I should be re-reading?
    – Yazmin
    Feb 1, 2016 at 18:14
  • tablesorter is CSS Feb 1, 2016 at 18:14
  • if you have problem with above css then you need to change version of in by apply /css/tablesorter/style.css?ver=1.0 Feb 1, 2016 at 18:15

1 Answer 1

0

I found the problem with my enqueue statements. There was a space ahead of the handle name of the wp_enqueue_scripts statements for both "tablesorterjs" and "tablesorterfunctions". Once I removed the space in front of the handle name, the scripts enqueued.

wp_register_script( 'tablesorterjs', plugins_url( '/js/jquery.tablesorter.js', __FILE__ ), array('jquery') );
wp_enqueue_script( 'tablesorterjs' );

wp_register_script( 'tablesorterfunctions', plugins_url( '/js/tablesorter.js', __FILE__ ), array('jquery') );
wp_enqueue_script( 'tablesorterfunctions' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.