Sorttable not working / jQuery problem
-
I noticed a problem with sorttable that I just wanted to report here in case anyone else needs help. I use jQuery 1.11.1 on my site, and alongside that I use wp_deregister_script to deregister the built-in jQuery ( which I realize IS currently 1.11.1 but I was having other problems with that ).
When I added the wp_deregister_script(‘jquery’) command to my functions.php file, csv to sorttable stopped working. It would load my table fine, but I couldn’t sort it. After much digging around, I found that the csv-to-sorttable script (sorttable.min.js) was no longer being loaded anywhere in my page.
I manually added sorttable.min.js to my functions.php file via the wp_enqueue_script command, and all was well again. I used the following line of code:
wp_enqueue_script('csv-sorttable', plugins_url('/csv-to-sorttable/js/sorttable.min.js'), '', '', true );
As an added bonus, I can have it load on only the needed page by using an if statement like so:if (is_page('87')){ wp_enqueue_script('csv-sorttable', plugins_url('/csv-to-sorttable/js/sorttable.min.js'), '', '', true ); }
I’m not good enough with jQuery to read through the csv-to-sorttable code and figure out why I need to do this, I’m just happy I got it working again. I’m marking this Resolved, I just wanted to document it here in case someone else runs into this issue.
- The topic ‘Sorttable not working / jQuery problem’ is closed to new replies.