Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

jquery.js conflict with popular wordpress plugins #645

Closed
colourweaver opened this issue Dec 19, 2015 · 3 comments
Closed

jquery.js conflict with popular wordpress plugins #645

colourweaver opened this issue Dec 19, 2015 · 3 comments

Comments

@colourweaver
Copy link

The latest version of FoundationPress is experiencing jquery.js conflict with popular wordpress plugins.

Below are 2 examples of well known wordpress plugins that are no longer working with the latest version of this theme. Other plugins that I regularly use are also no longer working.

Slider Revolution 5.1.5 - ThemePunch:

Hero Menu Version 1.6.2 - Hero Plugins:

  • Error occurs when activating the sticky menu capability

Settings:

Mamp Pro Version 3.5
FoundationPress Version 2.2.0
Wordpress Version 4.4
Xcode Version 7.2 (7C68)
Node.js Version 4.2.3
OS x EI Capitan version 10.11.12

  • Also tested both wordpress plugins via live websites.
@davidvandenbor
Copy link

Hi Colorweaver :-)

Could this be the same issue as the issue that I mentioned to Ole 3 months ago? See here (#451) My guess is that FoundationPress comes bundled with the CDN version of jQuery, and this causes issues with WordPress plugins, as WordPress plugins assume that WordPress takes care of "al things jQuery". Every version of WordPress comes bundled with jQuery, so you could either wrap your js code in "no-conflict" code tags, or enqueue jQuery the "WordPress way"

@colourweaver
Copy link
Author

Hey David,

Thanks for the tip, I have managed to resolve the errors for both of the plugins, "Slider Revolution" + "Hero Menu" through changing the following slice of code:

Step 1:
Location of file:
FoundationPress> Assets> Javascript> Custom> init-foundation.js>

Step 2:
Placed the following text in the "init-foundation.js" file:
< script>
jQuery.noConflict();
jQuery(document).foundation();
</ script>

Step 3:
Problem resolved

Another method that was also able to be use to resolve issue, was to delete all contents of the "foundation.js" file. I think this file may need a bit of fine tuning via the community. Foundation 5 had no issues with this functionality, only the recently published Foundation 6.

Thanks again :)

@olefredrik
Copy link
Owner

Running jQuery in noConflict mode should not be necessary since we only load one version of jQuery (Google CDN). I don't know if some third-party plugins require that jQuery is bundled with WordPress. Can't see why they would do that. There are many reasons why it's beneficial to use a CDN.

If for some reason two versions of jQuery are loaded (which is not recommended), calling $.noConflict( true ) from the second version will return the globally scoped jQuery variables to those of the first version.

https://api.jquery.com/jquery.noconflict/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants