I can’t seem to get the remote widgets to work in Wordpress. I get “Uncaught TypeError: Cannot read property ‘getJSON’ of undefined”. I am assuming that this is because Wordpress runs jQuery in No Conflict mode, which means that the “$” that normally symbolizes jQuery does not work. Does anyone know of any workarounds for this?
Edit: I made a local copy of vin65remotetools.1.1.js and changed all the “$” to “jQuery” and that indeed did fix the problem. However, I would still like to use the remote version of that file to take advantage of any changes that Vin65 might make to it. I’ve investigated various ways to disable jQuery No Conflict, but haven’t had any success yet.
Thanks, @tsartoris. That file uses the “$” shortcut for jQuery and, therefore, doesn’t work on my site either. Can you let me know which version of Wordpress you’re using? And are you loading the script with the Wordpress enqueue_script function?
From a WP developers perspective I know it seems like a horrible idea, but if you’re completely stuck, I see two options.
Add something like var $ = jQuery; before importing the remote widgets
or
Remove WPs built in jQuery and manually add your own from a CDN wp_deregister_script('jquery'); wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"), false, '2.2.4', true);
Just throwing it out there that either of these can cause problems with other WordPress plugins installed on the site.
Thanks, JaredS. I had thought about doing that. Normally, I create my own theme and try to use minimal plugins so I wouldn’t be too worried about doing that, but this is a site that I’m not in charge of, so yes, I worry that bypassing no conflict might cause some problems. I think I’ll just use the copy of the remotetools js file where I’ve changed the “$” to “jQuery”. It just means I’ll have to keep on top of any changes that Vin65 might make to that file, but as tsartoris mentioned, his old version still works fine, so hopefully any future changes will maintain backward compatibility.