Select to view content in your preferred language

ArcGIS Javascript API broken after latest WordPress release

8431
7
Jump to solution
12-23-2014 06:48 AM
DennisHunink
Deactivated User

SOLUTION: For everyone interested: turned out the solution was moving all files that use DoJo beneath the jQuery UI files, so that jQuery UI is fully loaded before any DoJo stuff loads. Moved them all in the footer in that order (jQuery, then jQuery UI and then alle DoJo related files).

I'm running a Wordpress website which uses both jQuery and the ArcGIS Javascript API v3.12. After recently upgrading from Wordpress 4.0.1 to 4.1, things broke. Dojo is returning multiple Error: multipleDefine errors.

Basically it looks like DoJo tries to load a new instance of jQuery, which it shouldn't, since WordPress has loaded jQuery already and there isn't a jQuery module available in the DoJo map. Furthermore, this issues seems to only exists in WordPress, not in a jsfiddle I made including exactly the same scripts.

For debugging purposes I first disabled all WordPress plugins, without any result; the problem kept existing. I went on and found a couple of interesting things. But I'm really stuck in the further debugging proces. I know the scope of this question is rather broad, but any thoughts at all are very much appreciated.

What I know so far/that i'm wondering about:

-Things stopt working after upgrading to WordPress 4.1

-In the info of the multipleDefine error it states https://js.arcgis.com/3.11/jquery.js, which is weird: it shouldn't be looking for jQuery there, since it's already included in Wordpress

-Things break as soon as I included the ArcGIS Javascript API, which includes DoJO, but only in WordPress; on a jsfiddle things work fine http://jsfiddle.net/dhunink/mry5vn3s/6/

Above leads me to the conclusion that something changed in the last WordPress release that effects my script, although I can't find anything in the release notes that could be linked to my issue.

Any thoughts, suggestions of comments are highly appreciated! Feel free to see all in action at https://tpgrf.nl/testserver/alpha/topotrainer/provincies/.

0 Kudos
1 Solution

Accepted Solutions
DennisHunink
Deactivated User

I'm sorry, did forgot to post the right answer here as well; just did. Thanks!

View solution in original post

0 Kudos
7 Replies
JeffPace
MVP Alum

Dojo and the javascript api don't use/load jquery.

KellyHutchins
Esri Frequent Contributor

Looks like Dennis got an answer to this question over on gis.stackexhange.com. Posting link here in case others run into this issue: ArcGIS Javascript API on Wordpress 4.1 - Geographic Information Systems Stack Exchange

JeffPace
MVP Alum

Nice.

0 Kudos
DennisHunink
Deactivated User

I'm sorry, did forgot to post the right answer here as well; just did. Thanks!

0 Kudos
RussellShirley
Emerging Contributor

Dennis,

i have been searching for information on how to use the JS API in Wordpress. It looks like you have figured it out. My company is building a new website and we want to have a simple map to show the location of power outages. Are you interested in working with us?

Thanks, Russell

0 Kudos
DennisHunink
Deactivated User

Hi Russell! You did got me curious about the details! For some reason I can't send you a private message on Geonet. Could you send me some more details by email? dennishunink AT me DOT com

0 Kudos
RussellShirley
Emerging Contributor

I sent you en email this morning.

0 Kudos