Gospel Country Micronation Forum Index Gospel Country Micronation
Founding one's own microstate
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 




Fixing jQuery Problems in WordPress Websites

 
Post new topic   Reply to topic    Gospel Country Micronation Forum Index -> Welcome to ForumsLand.com - Free forum hosting service
View previous topic :: View next topic  
Author Message
Kalooshk



Joined: 21 May 2013
Posts: 10

PostPosted: Tue May 21, 2013 12:39 pm    Post subject: Fixing jQuery Problems in WordPress Websites Reply with quote

Lots of WordPress plugin developers use jQuery to help you add features to your website. It drives lightboxes, drop-down menus, sliders and forms plus lots of other elements, so what do you do when it breaks or stops working?

jQuery is a very popular language on the web these days. It’s fairly easy to learn and implement on your site and it can add a lot of functionality which makes your site more user-friendly and better looking! You can learn about it here on the jQuery website.

If you are using it (maybe to show elements hidden with your CSS) or have installed plugins that rely on it, there may be issues with multiple instances of it being loaded. You can get around this, by adding some code to your theme‘s functions.php file, to ‘enqueue’ jQuery:

// Load jQuery
if ( !is_admin() ) {
wp_deregister_script(‘jquery’);
wp_register_script(‘jquery’, (“//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js”), false);
wp_enqueue_script(‘jquery’);
}

Here, we first ‘deregister’ jQuery to ensure that multiple copies aren’t already firing, then we register or load it using the Google jQuery script library. This is a good idea because lots of other sites seem to use this method and your visitors may already have it in their browser’s cache. Finally, we add jQuery to our queue so it is ready when needed.

Two other points that are worth noting:

Keep your Google library version number as current as possible. This reduces possible problems as changes are made to any plugins you are using.
When using your own jQuery script in a WordPress site, make sure to use ‘jQuery’ in full rather than the abbreviated ‘$’. Again, this limits conflicts. For example:

jQuery(document).ready(function(){
});
_________________
income protection insurance
Back to top
View user's profile Send private message
Free Forum






PostPosted:      Post subject: ForumsLand.com

Back to top
Display posts from previous:   
Post new topic   Reply to topic    Gospel Country Micronation Forum Index -> Welcome to ForumsLand.com - Free forum hosting service All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosted by ForumsLand.com - 100% free forum. Powered by phpBB 2.