Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Wrong Way of adding JQuery library to WordPress – Source of Javascript Conflicts

by

Tips and Tricks HQ Support Portal › Forums › General Stuff › Instructions/F.A.Q › Wrong Way of adding JQuery library to WordPress – Source of Javascript Conflicts

  • This topic has 0 replies, 1 voice, and was last updated 11 years, 11 months ago by amin007.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • April 29, 2011 at 6:44 am #2568
    amin007
    Participant

    We see a lot of themes and plugins not using the WordPress script enqueue function to include the popular JQuery library (this is recommended by WordPress):

    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    The developer seem to just include the library and test it on his site where a minimal number of plugin is running so he never sees the problem. The developer should be enqueuing the jQuery library that comes with WordPress to avoid conflicts with other plugins or themes. The 3rd example of this article explains the issue in more details:

    When Themes Go Wild – Importance of Using a Properly Coded WordPress Theme

    This issue is widely seen in themes or plugins developed by developers who just want to quickly make something eye catchy and then move on (without looking at the bigger picture or thinking about the future, performance or user experience). For example, the developer should be asking the following questions before blindly including a static version of JQuery library in his theme or plugin :

    – What will happen when a new version of WordPress is released?

    – What will happen with a new version of JQuery library is released?

    – Will my user suffer? Am I doing the right thing?

    – How can I implement my solution so I am not polluting the user’s WordPress environment?

    If you do want to use a particluar jquery library (for example: the one from Google) then your script should deregister the other JQuery engueue that comes from WordPress so that two instances of the library is not loaded on the page. Some theme developers seem to forget that the theme is not the only thing that will run on a WordPress site. It will share the space with other plugins so it needs to be coded in a way that lets everyone to coexist nicely.

    Note: Loading multiple copies of the same library not only causes plugin/theme conflict, it also slows your site down since the webpage is loading the same resource twice. So for the sake of your site’s performance you should make sure that your theme or plugin developer does not give you an improperly coded theme or plugin.

    Isolating the Source of the Issue

    You can do the test mentioned here to find out which theme or plugin is doing this:

    https://support.tipsandtricks-hq.com/forums/topic/test-to-identy-a-conflicting-theme-or-plugin

  • Author
    Posts
Viewing 1 post (of 1 total)
  • The topic ‘Wrong Way of adding JQuery library to WordPress – Source of Javascript Conflicts’ is closed to new replies.

Forum Related

  • Forum Home
  • Forum Search
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • WP PDF Stamper Documentation
  • WP Photo Seller Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial
  • WP Photo Seller Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Download Monitor

Copyright © 2023 | Tips and Tricks HQ